set_mode(3m_cli2)

πŸ“¦ version 3.2.0, in ubuntu resolute, ubuntu stonking

πŸ’– set_mode β€” the m_cli2 manual, section 3f, bestie πŸ’–

okay so real quick, this page lives in the m_cli2 manual (section 3f, Fortran vibes only obviously) and its whole name is set_mode(3f) β€” it's filed under [ARGUMENTS:M_CLI2] and it's licensed PD. Yes, Public Domain, we love a generous queen. πŸ‘‘


✨ NAME ✨

set_mode(3f) β€” [ARGUMENTS:M_CLI2] turn on optional modes (LICENSE:PD)

it's literally the "hey can we make this behave differently" switch. that's the whole job. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

subroutine set_mode(key,mode)

    character(len=*),intent(in) :: key
    logical,intent(in),optional :: mode

so you hand it a key, and maybe a mode if you're feeling fancy. 😌


🌸 DESCRIPTION 🌸

Allow optional behaviors.

that's it. that's the description. it lets you turn optional behaviors on. no cap. 🫢


πŸŽ€ OPTIONS πŸŽ€

  • KEY β€” name of option

The following values are allowed:

  • response_file β€” enable use of response file πŸ’Œ
  • ignorecase β€” ignore case in long key names. So the user does not have to remember if the option is --IgnoreCase or --ignorecase or --ignoreCase. like bestie, we are NOT memorizing your capitalization scheme, be serious. πŸ™ˆ
  • underdash β€” treat dash in keyword as an underscore. So the user should not have to remember if the option is --ignore_case or --ignore-case. both. both is good. ✨
  • strict β€” allow Boolean keys to be bundled, but requires a single dash prefix be used for short key names and long names must be prefixed with two dashes. so like, -t -x -o can squad up together, but long names gotta come correct with the --. no shortcuts, periodt. πŸ’…
  • lastonly β€” when multiple keywords occur keep the rightmost value specified instead of appending the values together. so the last one wins instead of everyone holding hands. πŸ‘‘
  • MODE β€” set to .true. to activate the optional mode. Set to .false. to deactivate the mode. It is .true. by default. so if you don't say anything, it's already on. main character default energy. 🌟

🌈 EXAMPLE 🌈

Sample program:

program demo_set_mode
use M_CLI2,  only : set_args, lget, set_mode
implicit none
character(len=*),parameter :: all='(*(g0))'
   !
   ! enable use of response files
   call set_mode('response_file')
   !
   ! Any dash in a keyword is treated as an underscore
   call set_mode('underdash')
   !
   ! The case of long keywords are ignored.
   ! Values and short names remain case-sensitive
   call set_mode('ignorecase')
   !
   ! short single-character boolean keys may be bundled
   ! but it is required that a single dash is used for
   ! short keys and a double dash for long keywords.
   call set_mode('strict')
   !
   call set_args(' --switch_X:X F --switch-Y:Y F --ox:O F -t F -x F -o F')
   !
   print all,'--switch_X or -X ... ',lget('switch_X')
   print all,'--switch_Y or -Y ... ',lget('switch_Y')
   print all,'--ox or -O       ... ',lget('ox')
   print all,'-o               ... ',lget('o')
   print all,'-x               ... ',lget('x')
   print all,'-t               ... ',lget('t')
end program demo_set_mode

look at that little demo go. it's giving competence. πŸ”₯ (and yes, ignorecase only vibes with long keywords β€” values and short names stay case-sensitive, that's not a bug that's the plot.)


πŸ‘‘ AUTHOR πŸ‘‘

John S. Urban, 2019. king behavior, honestly. 🫑


πŸ’œ LICENSE πŸ’œ

Public Domain

fr fr, take it, it's yours, no strings. 🎁

and that's the whole page bestie!! 🌸 this little diva is from the m_cli2 manual, source/version line says set_mode(3m_cli2) and the date on it is February 10, 2023 β€” so if you're citing it in your homework, that's your citation, iykyk. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from