module Tabular(T)
#
The Tabular
library.
Class methods#
.form(args : Array(String) = ARGV, &) : Bool
#
Define a set of Tablets
and an optional Habit#dispatch
.
Tabular.form do
option "--opt1" "-f", help: "a flag parameter"
option "--opt2" "-a", help: "a optiona with argument" { argument }
option "--opt2", help: "a flag with multiple arguments" do
argument "arg1_choice1", "arg1_choice2", "arg1_choice3"
argument "arg2_choice1", "arg2_choice2"
end
command "cmd1", "cmd1_alias", help: "a subcommand"
# An optional handler for command tablets
dispatch do |command|
if command.name == "cmd1"
Subcommand1.complete ARGV
end
end
end
.install!(args = ARGV, *, program : String = PROGRAM_NAME, command = Tabular.prompt)
#
Sends a completion script for the <shell>
specified in args.
- args: A list of user-specified arguments for the installer.
-
<shell>
: The shell to install the completions for (supports:bash
,fish
,zsh
).
-
--development <path>
: An alternate path to alias the CLI name to.
- program: The name of the CLI program. Best not to set this one.
- command: The subcommand the completion script will call to get completions.
Raises:
Error::Argument
— For malformed CLI arguments.Error::Support
— If shell is unsupported.
.install?(arg = ARGV, *, prompt = "completion")
#
Retrun true
and shift, if the first element in args i the prompt. to install a completion script.
.prompt=(value : String)
#
Set the name of the CLI argument that will prompt completions.
.prompt?(args = ARGV)
#
Retrun true
and shift, if the first element in args is the Tabular.prompt
.