Menu

Using the CLI

zacmarco

Using the CLI

Once CLI is run, you are supposed to see the main prompt, waiting for commands.

Easiest thing to do, is just typing the command completely with all needed parameters, and just typing ENTER.
So far, so good.

However, there are some special keys and commands that make usage of the CLI very straightforward, enabling all the special features provided by CLIck.

As already described, entering a context is performed by running the relevant command, according to the structure defined in the CLI structure XML file.
Three commands are automatically added into every context to get out of the current context:

  • exit: goes back to father context
  • end: goes back to CLI's main context
  • bye: gets completely out of the CLI (makes click_main() return)

Autocompletion

As per most of the available command-line tools, autocompletion is triggered by the TAB key.
Autocompletion requires you have already typed at least one character, as pressing TAB with nothing in the input buffer won't do anything.

CLIck, supports context/command aware intelligent autocompletion, that means that can complete:

  • commands
  • subcommands
  • commands and subcommands parameters

If one or more commands or parameters are matched, all the possible matches are printed-out, so only when one single match is available, text is auto-completed.

Command list and in-line help

By simply typing the ? key, all available commands, together with the relevant brief descriptions, will be printed out.
As for autocompletion, command list is context/command aware as well, that means that typing ? on a line where a command has already been identified, will print out the complete help of the identified command.
So summarizing:

  • pressing ? when no command has already been identified, will show all the available commands, as well as the relevant brief description.
  • pressing ? when a command has already been identified, will show the full help of that command.

Please note that full command help will also show the command's possible parameters.

History

History is quite similar to what all the typical shell applications do.

  • UP arrow key goes to previous command in the history
  • DOWN arrow key goes to next command in the history

At any time, special command history, automatically added in every context, will show up to the last 256 commands run. This number is statically set to 256 in release 0.1, and decided at runtime for all following releases.

When showing the command, an incremental number is associated with those commands.
It is possible to call again any of those commands, without the need of typing them again, just using the special command !<command_number>.

~~~~~~~~
main> credits
Not much to say:
- Marco Zac (zacmarco@gmail.com)

ENJOY!!!
main> config
config> exit
main> history
1 credits
2 config
3 exit
main> !1
credits
Not much to say:
- Marco Zac (zacmarco@gmail.com)

ENJOY!!!
main>
~~~~~~~


Related

Wiki: CLIck

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.