bluer-options


Namebluer-options JSON
Version 5.159.1 PyPI version JSON
download
home_pagehttps://github.com/kamangir/bluer-options
Summary🌀 Options for Bash.
upload_time2025-07-13 18:30:47
maintainerNone
docs_urlNone
authorArash Abadpour (Kamangir)
requires_pythonNone
licenseCC0-1.0
keywords
VCS
bugtrack_url
requirements blueness matplotlib numpy pymysql python-dotenv
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🌀 bluer-options

🌀 `bluer_options` implements an `options` argument for Bash.

## installation

```bash
pip install bluer_options
```

if using outside the [`bluer-ai`](https://github.com/kamangir/bluer-ai) ecosystem, add this line to `~/.bash_profile` or `~/.bashrc`,

```bash
source $(python3 -m bluer_options locate)/.bash/bluer_options.sh
```

for more refer to 🔻 [giza](https://github.com/kamangir/giza).

## usage

let the function receive one or more `options` arguments (example below) then parse them with `bluer_ai_option`, `bluer_ai_option_int`, and `bluer_ai_option_choice`.

```bash
function func() {
    local options=$1

    local var=$(bluer_ai_option "$options" var default)
    local key=$(bluer_ai_option_int "$options" key 0)
    local choice=$(bluer_ai_option_choice "$options" value_1,value_2,value_3 default)

    :
}
```

this enables the user to call `func` as,

```bash
func var=12,~key,value_1
```

all options have defaults and order doesn't matter.

<details>
<summary>example 1</summary>

here is an example use of an `options` in the [vancouver-watching 🌈](https://github.com/kamangir/vancouver-watching) ingest command:


```bash
 > @help vanwatch ingest
```
```bash
vanwatch \
	ingest \
	[area=<area>,count=<-1>,~download,dryrun,~upload] \
	[-|<object-name>] \
	[process,count=<-1>,~download,dryrun,gif,model=<model-id>,publish,~upload] \
	[--detect_objects 0] \
	[--overwrite 1] \
	[--verbose 1]
```

this command takes in an `options`, an `object`, and `args`. an `options` is a string representation of a dictionary, such as,

```bash
area=<vancouver>,~batch,count=<-1>,dryrun,gif,model=<model-id>,~process,publish,~upload
```

which is equivalent, in json notation, to,

```json
{
    "area": "vancouver",
    "batch": false,
    "count": -1,
    "dryrun": true,
    "gif": true,
    "model": "<model-id>",
    "process": false,
    "publish": true,
    "upload": false,
}
```

</details>

<details>
<summary>example 2</summary>

from [reddit](https://www.reddit.com/r/bash/comments/1duw6ac/how_can_i_automate_these_tree_commands_i/)

> How can I automate these tree commands I frequently need to type out?
I would like to run:
```bash
git add .
git commit -m "Initial "commit"
git push
```
> I got bored of typing them out each time. Can I make an alias or something like "gc" (for git commit). The commit message is always the same "Initial commit".

first, install `bluer-options`. this will also install [`blueness`](https://github.com/kamangir/blueness).

```bash
pip install bluer_options
```

then, copy [`example1.sh`](https://github.com/kamangir/bluer-options/blob/main/bluer_options/assets/example1.sh) to your machine and add this line to the end of your `bash_profile`,

```bash
source <path/to/example1.sh>
```

now, you have access to the `@git` super command. here is how it works.

1. `@git help` shows usage instructions (see below).
1. `@git commit` runs the three commands. you can customize the message by running `@git commit <message>`. you can also avoid the push by running `@git commit <message> ~push`.
1. for any `<task>` other than `commit`, `@git <task> <args>` runs `git <task> <args>`.

```
 > @git help
 @git commit [<message>] \
	~push
 . git commit with <message> and push.
@git <command>
 . git <command>.
 ```

![image](https://raw.githubusercontent.com/kamangir/assets/main/blue-options/example1.png)

</details>

---

> 🌀 [`blue-options`](https://github.com/kamangir/blue-options) for the [Global South](https://github.com/kamangir/bluer-south).

---

[![pylint](https://github.com/kamangir/bluer-options/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/bluer-options/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/bluer-options/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/bluer-options/actions/workflows/pytest.yml) [![PyPI version](https://img.shields.io/pypi/v/bluer-options.svg)](https://pypi.org/project/bluer-options/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/bluer-options)](https://pypistats.org/packages/bluer-options)

built by 🌀 [`blueness-3.118.1`](https://github.com/kamangir/blueness).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kamangir/bluer-options",
    "name": "bluer-options",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Arash Abadpour (Kamangir)",
    "author_email": "arash.abadpour@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/3f/84/f2c2294235662e49f3dcdaf7d2e72cd4a3929d4cfe8ac8b06167e9af3834/bluer_options-5.159.1.tar.gz",
    "platform": null,
    "description": "# \ud83c\udf00 bluer-options\n\n\ud83c\udf00 `bluer_options` implements an `options` argument for Bash.\n\n## installation\n\n```bash\npip install bluer_options\n```\n\nif using outside the [`bluer-ai`](https://github.com/kamangir/bluer-ai) ecosystem, add this line to `~/.bash_profile` or `~/.bashrc`,\n\n```bash\nsource $(python3 -m bluer_options locate)/.bash/bluer_options.sh\n```\n\nfor more refer to \ud83d\udd3b [giza](https://github.com/kamangir/giza).\n\n## usage\n\nlet the function receive one or more `options` arguments (example below) then parse them with `bluer_ai_option`, `bluer_ai_option_int`, and `bluer_ai_option_choice`.\n\n```bash\nfunction func() {\n    local options=$1\n\n    local var=$(bluer_ai_option \"$options\" var default)\n    local key=$(bluer_ai_option_int \"$options\" key 0)\n    local choice=$(bluer_ai_option_choice \"$options\" value_1,value_2,value_3 default)\n\n    :\n}\n```\n\nthis enables the user to call `func` as,\n\n```bash\nfunc var=12,~key,value_1\n```\n\nall options have defaults and order doesn't matter.\n\n<details>\n<summary>example 1</summary>\n\nhere is an example use of an `options` in the [vancouver-watching \ud83c\udf08](https://github.com/kamangir/vancouver-watching) ingest command:\n\n\n```bash\n > @help vanwatch ingest\n```\n```bash\nvanwatch \\\n\tingest \\\n\t[area=<area>,count=<-1>,~download,dryrun,~upload] \\\n\t[-|<object-name>] \\\n\t[process,count=<-1>,~download,dryrun,gif,model=<model-id>,publish,~upload] \\\n\t[--detect_objects 0] \\\n\t[--overwrite 1] \\\n\t[--verbose 1]\n```\n\nthis command takes in an `options`, an `object`, and `args`. an `options` is a string representation of a dictionary, such as,\n\n```bash\narea=<vancouver>,~batch,count=<-1>,dryrun,gif,model=<model-id>,~process,publish,~upload\n```\n\nwhich is equivalent, in json notation, to,\n\n```json\n{\n    \"area\": \"vancouver\",\n    \"batch\": false,\n    \"count\": -1,\n    \"dryrun\": true,\n    \"gif\": true,\n    \"model\": \"<model-id>\",\n    \"process\": false,\n    \"publish\": true,\n    \"upload\": false,\n}\n```\n\n</details>\n\n<details>\n<summary>example 2</summary>\n\nfrom [reddit](https://www.reddit.com/r/bash/comments/1duw6ac/how_can_i_automate_these_tree_commands_i/)\n\n> How can I automate these tree commands I frequently need to type out?\nI would like to run:\n```bash\ngit add .\ngit commit -m \"Initial \"commit\"\ngit push\n```\n> I got bored of typing them out each time. Can I make an alias or something like \"gc\" (for git commit). The commit message is always the same \"Initial commit\".\n\nfirst, install `bluer-options`. this will also install [`blueness`](https://github.com/kamangir/blueness).\n\n```bash\npip install bluer_options\n```\n\nthen, copy [`example1.sh`](https://github.com/kamangir/bluer-options/blob/main/bluer_options/assets/example1.sh) to your machine and add this line to the end of your `bash_profile`,\n\n```bash\nsource <path/to/example1.sh>\n```\n\nnow, you have access to the `@git` super command. here is how it works.\n\n1. `@git help` shows usage instructions (see below).\n1. `@git commit` runs the three commands. you can customize the message by running `@git commit <message>`. you can also avoid the push by running `@git commit <message> ~push`.\n1. for any `<task>` other than `commit`, `@git <task> <args>` runs `git <task> <args>`.\n\n```\n > @git help\n @git commit [<message>] \\\n\t~push\n . git commit with <message> and push.\n@git <command>\n . git <command>.\n ```\n\n![image](https://raw.githubusercontent.com/kamangir/assets/main/blue-options/example1.png)\n\n</details>\n\n---\n\n> \ud83c\udf00 [`blue-options`](https://github.com/kamangir/blue-options) for the [Global South](https://github.com/kamangir/bluer-south).\n\n---\n\n[![pylint](https://github.com/kamangir/bluer-options/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/bluer-options/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/bluer-options/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/bluer-options/actions/workflows/pytest.yml) [![PyPI version](https://img.shields.io/pypi/v/bluer-options.svg)](https://pypi.org/project/bluer-options/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/bluer-options)](https://pypistats.org/packages/bluer-options)\n\nbuilt by \ud83c\udf00 [`blueness-3.118.1`](https://github.com/kamangir/blueness).\n",
    "bugtrack_url": null,
    "license": "CC0-1.0",
    "summary": "\ud83c\udf00 Options for Bash.",
    "version": "5.159.1",
    "project_urls": {
        "Homepage": "https://github.com/kamangir/bluer-options"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "60f468e081e7c501d7c9a9689bf0403bf88a057332df9706514167b06a5d5a63",
                "md5": "d836a5175f0d89c27c0f13d605b37138",
                "sha256": "e2e77535e8c4b4fdb7476faad08947c5439f8393826f4ac5edde1613f32ead8a"
            },
            "downloads": -1,
            "filename": "bluer_options-5.159.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d836a5175f0d89c27c0f13d605b37138",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 43391,
            "upload_time": "2025-07-13T18:30:46",
            "upload_time_iso_8601": "2025-07-13T18:30:46.480653Z",
            "url": "https://files.pythonhosted.org/packages/60/f4/68e081e7c501d7c9a9689bf0403bf88a057332df9706514167b06a5d5a63/bluer_options-5.159.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3f84f2c2294235662e49f3dcdaf7d2e72cd4a3929d4cfe8ac8b06167e9af3834",
                "md5": "d88c34b8f2ee16cc2ce21584a8f27689",
                "sha256": "f24ecdf20c4d8051e746ce3efc713cbb79ba3a3313da8c9294b6ca0914f2f99e"
            },
            "downloads": -1,
            "filename": "bluer_options-5.159.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d88c34b8f2ee16cc2ce21584a8f27689",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 29470,
            "upload_time": "2025-07-13T18:30:47",
            "upload_time_iso_8601": "2025-07-13T18:30:47.631134Z",
            "url": "https://files.pythonhosted.org/packages/3f/84/f2c2294235662e49f3dcdaf7d2e72cd4a3929d4cfe8ac8b06167e9af3834/bluer_options-5.159.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-13 18:30:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kamangir",
    "github_project": "bluer-options",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "blueness",
            "specs": []
        },
        {
            "name": "matplotlib",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "pymysql",
            "specs": []
        },
        {
            "name": "python-dotenv",
            "specs": []
        }
    ],
    "lcname": "bluer-options"
}
        
Elapsed time: 0.97806s