This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-antigen-parse-args () { | |
576 # An argument parsing functionality to parse arguments the *antigen* way :). | |
577 # Takes one first argument (called spec), which dictates how to parse and | |
578 # the rest of the arguments are parsed. Outputs a piece of valid shell code | |
579 # that can be passed to `eval` inside a function which creates the arguments | |
580 # and their values as local variables. Suggested use is to set the defaults | |
581 # to all arguments first and then eval the output of this function. | |
582 | |
583 # Spec: Only long argument supported. No support for parsing short options. | |
584 # The spec must have two sections, separated by a `;`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-antigen-parse-args () { | |
local spec="$1" | |
shift | |
spec="$(echo "$spec" | tr '\n' ' ' | sed 's/[[:space:]]//g')" | |
local code='' | |
--add-var () { | |
test -z "$code" || code="$code\n" | |
code="${code}local $1='$2'" | |
} | |
local positional_args="$(echo "$spec" | cut -d\; -f1)" |
OlderNewer