Skip to content

Commit

Permalink
@help refactor - kamangir/bolt#746
Browse files Browse the repository at this point in the history
  • Loading branch information
kamangir committed Jan 5, 2025
1 parent 5bfb0ea commit cc4bf97
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.174.1`](https://github.com/kamangir/awesome-bash-cli), based on 🪄 [`abcli-9.444.1`](https://github.com/kamangir/awesome-bash-cli).
built by 🌀 [`blue_options-4.174.1`](https://github.com/kamangir/awesome-bash-cli), based on 🪄 [`abcli-9.445.1`](https://github.com/kamangir/awesome-bash-cli).
11 changes: 0 additions & 11 deletions abcli/.abcli/plugins/build_README.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@

function abcli_build_README() {
local options=$1

local plugin_name=$(abcli_option "$options" plugin abcli)

if [ $(abcli_option_int "$options" help 0) == 1 ]; then
options="push"
[[ "$plugin_name" == "abcli" ]] &&
options="$options,plugin=<plugin-name>"
abcli_show_usage "$plugin_name build_README [$options]" \
"build $plugin_name/README.md."
return
fi

local do_push=$(abcli_option_int "$options" push 0)

local repo_name=$(abcli_unpack_repo_name $plugin_name)
Expand Down
2 changes: 2 additions & 0 deletions abcli/.abcli/tests/help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ function test_abcli_help() {
\
"@browse" \
\
"@build_README" \
\
"@cat" \
\
"@docker browse " \
Expand Down
2 changes: 1 addition & 1 deletion abcli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

DESCRIPTION = f"{ICON} a language to speak AI."

VERSION = "9.444.1"
VERSION = "9.445.1"

REPO_NAME = "awesome-bash-cli"

Expand Down
26 changes: 26 additions & 0 deletions abcli/help/build_README.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from typing import List

from blue_options.terminal import show_usage, xtra


def help_build_README(
tokens: List[str],
mono: bool,
plugin_name: str = "abcli",
) -> str:
options = "push"

callable = f"{plugin_name} build_README"

if plugin_name == "abcli":
options = f"{options},plugin=<plugin-name>"
callable = "@build_README"

return show_usage(
callable.split(" ")
+ [
f"[{options}]",
],
f"build {plugin_name}/README.md.",
mono=mono,
)
6 changes: 6 additions & 0 deletions abcli/help/generic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import List, Dict, Callable, Union

from abcli.help.build_README import help_build_README
from abcli.help.pypi import help_functions as help_pypi
from abcli.help.pylint import help_pylint
from abcli.help.pytest import help_pytest
Expand All @@ -10,6 +11,11 @@ def help_functions(
plugin_name: str = "abcli",
) -> Union[Callable, Dict[str, Union[Callable, Dict]]]:
return {
"build_README": lambda tokens, mono: help_build_README(
tokens,
mono=mono,
plugin_name=plugin_name,
),
"pypi": help_pypi(plugin_name=plugin_name),
"pylint": lambda tokens, mono: help_pylint(
tokens,
Expand Down

0 comments on commit cc4bf97

Please sign in to comment.