🌀 an options for Bash.
Project description
🌀 blue-options
🌀 blue_options
implements an options
argument for Bash.
here is an example use of an options
in the vancouver-watching 🌈 ingest command:
> vanwatch help
vanwatch ingest \
area=<vancouver>,~batch,count=<-1>,dryrun,gif,model=<model-id>,~process,publish,~upload \
-|<object-name> \
[<args>]
. ingest <area> -> <object-name>.
this command takes in an options
, an object
, and args
. an options
is a string representation of a dictionary, such as,
area=<vancouver>,~batch,count=<-1>,dryrun,gif,model=<model-id>,~process,publish,~upload
which is equivalent, in json notation, to,
{
"area": "vancouver",
"batch": false,
"count": -1,
"dryrun": true,
"gif": true,
"model": "<model-id>",
"process": false,
"publish": true,
"upload": false,
}
for more refer to 🔻 giza.
installation
pip install blue_options
add this line to your ~/.bash_profile
or ~/.bashrc
,
source $(python -m blue_options locate)/.bash/blue_options.sh
usage
let your function receive an options
argument, then parse it with abcli_options
and abcli_options_int
.
function func() {
local options=$1
local var=$(abcli_options "$options" var default)
local key=$(abcli_options_int "$options" key 0)
[[ "$key" == 1 ]] &&
echo "var=$var"
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
blue_options-4.23.1.tar.gz
(7.7 kB
view hashes)
Built Distribution
Close
Hashes for blue_options-4.23.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e58cc17563a3251388bfc61fca1247b9a8d02e5a232f1fa420da794ec245583 |
|
MD5 | 0d2941118ecbdc683205b8b069b7bf25 |
|
BLAKE2b-256 | 8ab923903eec484f2904266aa5cbad97736289674f93cf41efd967067f44da1e |