ELGETOPT(1)

πŸ“¦ version 2.9.9.2, in nixpkgs unstable

πŸ’… elgetopt(1) β€” the General Commands Manual, but make it group chat

okay so bestie, welcome to elgetopt πŸ’– this is the elgetopt(1) page and honestly it's giving "tiny tool, huge personality".

✨ NAME ✨

elgetopt β€” perform getopt-style parsing on the arguments to an execline script πŸŽ€ (yes, that's literally the whole job, and it does it slayfully)

✨ SYNOPSIS ✨

elgetopt [-D default] optstring prog...

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe check first: elgetopt expects to find a valid number n of arguments in the # environment variable, plus n+1 environment variables 0, 1, ..., n. and if that's not the case? it exits 100. no cap, that's the deal. πŸ’€

then elgetopt pushes environment variables (cf. execline-pushenv(7)) starting with ELGETOPT_. and if you want the previous values back, you literally just use emptyenv -o. iconic. 🫢

elgetopt looks into 1, 2, ... for options, as specified by optstring, which is a standard getopt(1) string. periodt.

if the -c switch is recognized, elgetopt sets the ELGETOPT_c environment variable. the value of that variable is the argument to the -c switch if it has one, and 1 (or default if given) otherwise. ✨

after setting all recognized options, elgetopt makes new #, 1, 2, ... "positional parameters" with whatever remains. leftovers but make them fashion. πŸ‘‘

then elgetopt execs into prog... πŸš€

⚠️ GNU-style options are not supported. bestie please, don't come at it with --long-option, it will not eat that. πŸ™ˆ

🌸 OPTIONS 🌸

  • -D default β€” use default as the value for the ELGETOPT_c environment variable if there is no argument to the -c switch. Default is 1. the value is the same for all the options defined by elgetopt. (one value to rule them all πŸ’…)

πŸ”₯ SEE ALSO πŸ”₯

dollarat(1), getopt(1), shift(1), execline-pushenv(7)

this man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/elgetopt.html

πŸ‘‘ AUTHORS πŸ‘‘

Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)


and that's the whole thing, bestie 🌈 this cutie was brought to you by Debian, dated April 3, 2023 β€” mwah, go parse some args, iykyk πŸ“πŸ§šπŸ’œ

πŸ“¦ where this page comes from