# argsh This is a somewhat simple shell wrapper for scripts that handles argument parsing, because argument parsing in bash is a pain in the ass. ## Installation Build with `cargo build --release` and copy the resulting binary to somewhere in your path. ## Usage Put argsh in the shebang, instead of your shell as such: ```bash #!/bin/env -S argsh ``` And you define the arguments as a semicolon separated list of arguments. The only valid characters for an argument are `a-z`, `0-9` and `-`. A plain argument such as `arg` is a required argument, which will be passed to the script as a positional argument. An argument starting with `#` such as `#arg` is an optional argument, which will be passed to the script as an environment variable like `$ARGSH_ARG`, where all `-` get converted to `_`. An argument starting with `?` such as `?arg` is a flag, which will be passed to the script as an environment variable like `$ARGSH_ARG`, where all `-` get converted to `_`, with the value set to `1`, the value is irrelevant, just check if the variable is empty. Any additional positional arguments passed to the script get appended after the required arguments. Short arguments are supported, but only the first argument that starts with a certain character will be matched by the short argument, for example, with the arguments `foo;fuzz`, `-f` will only match `foo`, to be able to match both with short arguments, override the short argument for `fuzz` like `foo;fuzz:z`, now `-f` will match `foo` and `-z` will match `fuzz`. **NOTE:** matching is based on order, so an explicit short argument won't take priority over an implicit one that came first, for example, in a case such as `foo;bar:f`, `-f` will still match `foo`, as it is defined first. Optionally, you can set the shell to use as such `bash|name;count;etc`, defaults to `sh` if ommited. There is a limit of 256 required arguments (if you have anything close to that please use an actual programming language). ## Testing Run the test script as such and mess around with the arguments ``` ./test --required indeed --also-required nice --flag --optional woah --second-optional crazy am additional ```