From f08eb9d3bf3e73f380f40fc1663e4a05af043b28 Mon Sep 17 00:00:00 2001 From: kamangir Date: Sun, 3 Nov 2024 16:01:57 -0800 Subject: [PATCH] help++ - kamangir/bolt#746 --- README.md | 2 +- abcli/.abcli/tests/help.sh | 9 +++ abcli/__init__.py | 2 +- abcli/help/docker.py | 150 +++++++++++++++++++++++++++++++++++++ abcli/help/functions.py | 2 + 5 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 abcli/help/docker.py diff --git a/README.md b/README.md index ce8f4c7c..8f18cc5f 100644 --- a/README.md +++ b/README.md @@ -63,4 +63,4 @@ create a copy of [`sample.env`](./abcli/sample.env) as `.env` and fill in the se [![pylint](https://github.com/kamangir/awesome-bash-cli/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/awesome-bash-cli/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/awesome-bash-cli/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/awesome-bash-cli/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/awesome-bash-cli/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/awesome-bash-cli/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/abcli.svg)](https://pypi.org/project/abcli/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/abcli)](https://pypistats.org/packages/abcli) -built by 🌀 [`blue_options-4.148.1`](https://github.com/kamangir/awesome-bash-cli), based on 🪄 [`abcli-9.394.1`](https://github.com/kamangir/awesome-bash-cli). +built by 🌀 [`blue_options-4.148.1`](https://github.com/kamangir/awesome-bash-cli), based on 🪄 [`abcli-9.395.1`](https://github.com/kamangir/awesome-bash-cli). diff --git a/abcli/.abcli/tests/help.sh b/abcli/.abcli/tests/help.sh index 7d1c1be7..53f0d167 100644 --- a/abcli/.abcli/tests/help.sh +++ b/abcli/.abcli/tests/help.sh @@ -5,6 +5,15 @@ function test_abcli_help() { local module for module in \ + "@docker browse " \ + "@docker build " \ + "@docker clear " \ + "@docker eval " \ + "@docker push " \ + "@docker run " \ + "@docker seed " \ + "@docker source " \ + \ "@git" \ "@git browse" \ "@git checkout" \ diff --git a/abcli/__init__.py b/abcli/__init__.py index b402346e..390b1c41 100644 --- a/abcli/__init__.py +++ b/abcli/__init__.py @@ -6,7 +6,7 @@ DESCRIPTION = f"{ICON} a language to speak AI." -VERSION = "9.394.1" +VERSION = "9.395.1" REPO_NAME = "awesome-bash-cli" diff --git a/abcli/help/docker.py b/abcli/help/docker.py new file mode 100644 index 00000000..59bdfdeb --- /dev/null +++ b/abcli/help/docker.py @@ -0,0 +1,150 @@ +from typing import List + +from blue_options.terminal import show_usage, xtra + + +def help_browse( + tokens: List[str], + mono: bool, +) -> str: + options = xtra("~public", mono=mono) + + return show_usage( + [ + "@docker", + "browse", + f"[{options}]", + ], + "browse docker-hub.", + mono=mono, + ) + + +def help_build( + tokens: List[str], + mono: bool, +) -> str: + options = xtra("dryrun,no_cache,~push,run,verbose", mono=mono) + + return show_usage( + [ + "@docker", + "build", + f"[{options}]", + ], + "build the abcli docker image.", + mono=mono, + ) + + +def help_clear( + tokens: List[str], + mono: bool, +) -> str: + return show_usage( + [ + "@docker", + "clear", + ], + "clear docker.", + mono=mono, + ) + + +def help_eval( + tokens: List[str], + mono: bool, +) -> str: + options = xtra("cat,dryrun,verbose", mono=mono) + + return show_usage( + [ + "@docker", + "eval", + f"[{options}]", + "", + ], + "run through the abcli docker image.", + mono=mono, + ) + + +def help_push( + tokens: List[str], + mono: bool, +) -> str: + options = "actions|repo" + + return show_usage( + [ + "@docker", + "push", + ], + "push the abcli docker image.", + mono=mono, + ) + + +def help_run( + tokens: List[str], + mono: bool, +) -> str: + options = xtra("dryrun", mono=mono) + + return show_usage( + [ + "@docker", + "run", + f"[{options}]", + ], + "run abcli docker image.", + mono=mono, + ) + + +def help_seed( + tokens: List[str], + mono: bool, +) -> str: + options = "actions|repo" + + return show_usage( + [ + "@plugin", + "browse", + f"[{options}]", + ], + "browse blue_plugin.", + mono=mono, + ) + + +def help_source( + tokens: List[str], + mono: bool, +) -> str: + options = xtra("cat,dryrun,verbose", mono=mono) + + return show_usage( + [ + "@docker", + "source", + f"[{options}]", + "", + "[]", + ], + "source through the abcli docker image.", + mono=mono, + ) + + +help_functions = { + "browse": help_browse, + "build": help_build, + "clear": help_clear, + "eval": help_eval, + "push": help_push, + "run": help_run, + "seed": help_seed, + "source": help_source, +} diff --git a/abcli/help/functions.py b/abcli/help/functions.py index 9728ae10..a1f46bd1 100644 --- a/abcli/help/functions.py +++ b/abcli/help/functions.py @@ -1,4 +1,5 @@ from abcli.help.cp import help_cp +from abcli.help.docker import help_functions as help_docker from abcli.help.download import help_download from abcli.help.gif import help_gif from abcli.help.git import help_functions as help_git @@ -15,6 +16,7 @@ help_functions = { "cp": help_cp, + "docker": help_docker, "download": help_download, "gif": help_gif, "git": help_git,