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.
This commit is contained in:
rwxrob 2021-08-31 22:00:16 -04:00
parent 1070f958f7
commit 159b2e78d7
No known key found for this signature in database
GPG Key ID: 1CCACEDD2F65578E
2 changed files with 7 additions and 24 deletions

View File

@ -16,14 +16,8 @@ This `cmd` inside can then be renamed and finished.
* Name repos containing single bash commands with `cmd-` * Name repos containing single bash commands with `cmd-`
* Name template repos beginning with `template-` * Name template repos beginning with `template-`
* Start command functions with `x_` to be completed * 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. Think of `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.
## Builtins and Utilities ## 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*

21
cmd
View File

@ -36,14 +36,8 @@ This `cmd` inside can then be renamed and finished.
* Name repos containing single bash commands with `cmd-` * Name repos containing single bash commands with `cmd-`
* Name template repos beginning with `template-` * Name template repos beginning with `template-`
* Start command functions with `x_` to be completed * 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. Think of `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.
## Builtins and Utilities ## Builtins and Utilities
@ -155,7 +149,7 @@ Please mention rwxrob.tv'
HELP[foo]='Foos things.' HELP[foo]='Foos things.'
x_foo() { x_foo () {
_filter "$@" && return $? _filter "$@" && return $?
echo "would foo: $*" echo "would foo: $*"
} }
@ -168,7 +162,7 @@ HELP[bar]='
Bar the things.' Bar the things.'
x_foo() { x_bar() {
_buffer "$@" && return $? _buffer "$@" && return $?
echo "would bar: $*" echo "would bar: $*"
} }
@ -179,11 +173,6 @@ x_some.config.setting() {
x_config some.config.setting "$@" x_config some.config.setting "$@"
} }
x__hidden() {
_filter "$@" && return $?
echo "would run _hidden: $*"
}
############################## BOILERPLATE ########################### ############################## BOILERPLATE ###########################
## Everything from here to the end of file can be snipped and updated ## Everything from here to the end of file can be snipped and updated
## with latest from https://github.com/rwxrob/template-bash-command. ## with latest from https://github.com/rwxrob/template-bash-command.
@ -364,7 +353,7 @@ x_config() {
val*) shift; _config_vals "$@"; return $? ;; val*) shift; _config_vals "$@"; return $? ;;
esac esac
case $# in case $# in
0) _config_dump ;; 0) _config_dump ;;
1) _config_get "$@" ;; 1) _config_get "$@" ;;
*) _config_set "$@" ;; *) _config_set "$@" ;;
esac esac
@ -514,7 +503,7 @@ mapfile -t COMMANDS < \
if [[ -n $COMP_LINE ]]; then if [[ -n $COMP_LINE ]]; then
line=${COMP_LINE#* } line=${COMP_LINE#* }
for c in "${COMMANDS[@]}"; do for c in "${COMMANDS[@]}"; do
[[ ${c:0:${#line}} == "${line,,}" && ${c:0:1} != _ ]] && echo "$c" [[ ${c:0:${#line}} == "${line,,}" ]] && echo "$c"
done done
exit exit
fi fi