Skip to content

Commit

Permalink
applied several fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
gobuki committed Mar 31, 2024
1 parent dedec69 commit 23c23f5
Show file tree
Hide file tree
Showing 6 changed files with 212 additions and 59 deletions.
38 changes: 38 additions & 0 deletions DEVELOPMENT-LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,3 +649,41 @@

DEV-0048 done
2024-03-31

New:
DEV-0049 interactive user acknowledgment of expanded command does not work in zsh

_cli_yes_no_prompt:read:1: -p: no coprocess

DEV-0050 detected through bats testing: commands parameterized by function do not execute
when the interactive auto complete function didn't run before (<TAB><TAB>)

DEV-0051 in zsh, during execution, detection of sourcing doesn't work
result is that the shell runs exit when it is running from
the sourced function. This should only happen when the script
is called directly (=in a subshell)

DEV-0052 script prints name from previous execution, when no command is found

$ testcli --cli-use-awk-command output=command_names
not a recognized command: '--cli-use-awk-command output=command_names'
execute 'tomcat ?' or 'tomcat -h' to display available commands

DEV-0053 Commands are expanded in batch mode. Should not happen.
The reason is, that the command expansion flag was really only working to
disable argument expansion. Introduce a new flag for command expansion.

DEV-0054 special error codes for cli errors


DEV-0046 done
DEV-0049 done
DEV-0050 done
DEV-0051 done
DEV-0052 done
DEV-0053 done. New flag is CFG_EXEC_EXPAND_ABBREVIATED_COMMANDS (default: "y")
DEV-0054 done



15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Runs the embedded AWK config parser script. Only there for development purposes.

# Builtin Help Output

If the CLI is executed it just a '?' as argument it will print the help for
If the CLI is executed with '?' as sole argument, it will print the help for
all configured commands.

'?' can also be append to complete or incomplete commands.
Expand Down Expand Up @@ -226,10 +226,23 @@ Considering the configuration above, you could execute `cluster-cli d l c` and i
$ cluster-cli


# Exit status

In case of failed command execution the script uses the exit status to indicate
the reason

- 49 script was called with wrong name. need to create a link and use this.
- 50 no command supplied
- 51 attempt to expand abbreviated command failed
- 52 not all positional arguments could be resolved. not enough arguments.
- 53 not enough arguments provided


# Zsh support with bashcompinit
.zshrc:

autoload bashcompinit
bashcompinit

# if you want to use completion with an alias you need to set this
setopt completealiases
12 changes: 10 additions & 2 deletions README_DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,20 @@ abbreviation of commands.

## AWK config parser usage examples:

% cli --cli-run-awk-command output=commands command_filter="filter bla rating"

### print all available info about a specific complete command

$ cli --cli-run-awk-command output=commands command_filter="filter bla rating"
__COMMAND=filter bla rating
__COMMAND_ARG[0]="list:lt|le|qe|gt|ge:comparison operator"
__COMMAND_ARG[1]="int_range:1-5:rating value to compare against"

% cli --cli-run-awk-command output=commands command_filter="set comment"
$ cli --cli-run-awk-command output=commands command_filter="set comment"
__COMMAND=set comment
__COMMAND_ARG[0]="INTEGER"
__COMMAND_ARG[1]="STRING"


### print a list of available commands without formatting

$ cli --cli-run-awk-command output="command_names"
Loading

0 comments on commit 23c23f5

Please sign in to comment.