From 159b2e78d7c7644b69ce53beeb50714dae7c7fa8 Mon Sep 17 00:00:00 2001 From: rwxrob Date: Tue, 31 Aug 2021 22:00:16 -0400 Subject: [PATCH] Drop 'hidden' public commands They are just too risky to promote because people might create dependencies on them. Something is either exported and public or it's not. --- README.md | 10 ++-------- cmd | 21 +++++---------------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 6c8c14c..cad63da 100644 --- a/README.md +++ b/README.md @@ -16,14 +16,8 @@ This `cmd` inside can then be renamed and finished. * Name repos containing single bash commands with `cmd-` * Name template repos beginning with `template-` * Start command functions with `x_` to be completed -* Start command functions with `x__` to not be completed -Think of the `x` as in "executable" command. - -If you want to keep a command but hide it from users just add another -underscore to the prefix which turns it into a hidden command, which -will not be included in help documentation and tab completion, but will -still be there. +Think of `x` as in "executable" command. ## Builtins and Utilities @@ -248,5 +242,5 @@ Displays a summary of usage. ---- -*Autogenerated Tue Aug 31 09:39:48 PM EDT 2021* +*Autogenerated Tue Aug 31 10:00:12 PM EDT 2021* diff --git a/cmd b/cmd index 91d9fc7..5d7af90 100755 --- a/cmd +++ b/cmd @@ -36,14 +36,8 @@ This `cmd` inside can then be renamed and finished. * Name repos containing single bash commands with `cmd-` * Name template repos beginning with `template-` * Start command functions with `x_` to be completed -* Start command functions with `x__` to not be completed -Think of the `x` as in "executable" command. - -If you want to keep a command but hide it from users just add another -underscore to the prefix which turns it into a hidden command, which -will not be included in help documentation and tab completion, but will -still be there. +Think of `x` as in "executable" command. ## Builtins and Utilities @@ -155,7 +149,7 @@ Please mention rwxrob.tv' HELP[foo]='Foos things.' -x_foo() { +x_foo () { _filter "$@" && return $? echo "would foo: $*" } @@ -168,7 +162,7 @@ HELP[bar]=' Bar the things.' -x_foo() { +x_bar() { _buffer "$@" && return $? echo "would bar: $*" } @@ -179,11 +173,6 @@ x_some.config.setting() { x_config some.config.setting "$@" } -x__hidden() { - _filter "$@" && return $? - echo "would run _hidden: $*" -} - ############################## BOILERPLATE ########################### ## Everything from here to the end of file can be snipped and updated ## with latest from https://github.com/rwxrob/template-bash-command. @@ -364,7 +353,7 @@ x_config() { val*) shift; _config_vals "$@"; return $? ;; esac case $# in - 0) _config_dump ;; + 0) _config_dump ;; 1) _config_get "$@" ;; *) _config_set "$@" ;; esac @@ -514,7 +503,7 @@ mapfile -t COMMANDS < \ if [[ -n $COMP_LINE ]]; then line=${COMP_LINE#* } for c in "${COMMANDS[@]}"; do - [[ ${c:0:${#line}} == "${line,,}" && ${c:0:1} != _ ]] && echo "$c" + [[ ${c:0:${#line}} == "${line,,}" ]] && echo "$c" done exit fi