🌀 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.20.1.tar.gz
(5.9 kB
view hashes)
Built Distribution
Close
Hashes for blue_options-4.20.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0564b044ee47c3a4be806ed0ec31900dd0a26ec92a8893e2229b1a903ae31743 |
|
MD5 | 057b7ed25cb9a56256bd3a50e2ce0f8f |
|
BLAKE2b-256 | 689c823543a96a8e5b7f50175b0b4f9f81fb4f99d626146c137e3d59aa5d3ea0 |