BREAKING CHANGES
The print-summary
command was removed, and replaced with print-errors
. When a command has input
errors, only a brief summary of the command name is printed (previously, it was the entire command summary
including options and arguments).
The tool and command name, when printed in summaries and errors, is now consistently in bold green.
Moves specs to their own namespace.
Ensure that most output (such as command summaries, prompts, help text)
goes to *err*
, not *out*
.
Added an on-disk caching mechanism to avoid loading most namespaces when dispatching to commands.
Added function net.lewisship.cli-tools/ask
, which prompts the user
for input (such as "yes" or "no").
Use the same separator (,
, not /
) for tool options as for command options.
Added net.lewisship.cli-tools.job-status
namespace, which provides dynamic feedback
for multiple long-running jobs.
Added new function select-option
, used to build the option spec for an option
selected from a list of possible values.
Improved the output of command mismatches (where the input is not sufficient to uniquely identify a command), and removed the fuzzy match ("did you mean?") that did not seem to provide any real benefit.
Tools that make use of dispatch
now add two new leading switches:
-C
,--color
: enables ANSI colors, even if otherwise disabled-N
,--no-color
: disables ANSI colors, even if otherwise enabled
Like -h
, --help
, these must precede any command names.
See org.clj-commons/pretty for details on when ANSI is enabled or disabled normally.
Testing was simplified; command functions can be tested by passing them a single map of option and argument values (previously the values map was nested in another map).
Namespaces now represent categories of related commands; this changes the output from the help
command.
Further, categories may also be command groups, which applies a prefix to all commands within the category
(this is useful with tools that define large numbers of subcommands).
Switched from io.aviso/pretty to org.clj-commons/pretty.
Make use of more fonts, and bump io.aviso/pretty to version 1.4.2.
Exposed a best-match
function which uses the same match logic as
the dispatch function.
Added default for :tool-name option (to dispatch
), determined from the babashka.file
system property.
Added :validate directive to command interface, allowing for validations that involve multiple options.
Add public exit
function as a testable way to call System/exit
.
Now highlights the tool name and command name in bold, in error messages.
Now suggests the most likely command name when the given name doesn't match exactly one command.
Added support for the :let keyword in the command interface.
Changed defcommand
to create a variadic function.
Added checks that options and argument symbols are unique; now all parsed options
and positional arguments are provided in a single :options
map, which simplifies
testing.
Fix logic for default command summary to just be first line of docstring.
Don't catch exceptions in dispatch
.
Split the dispatch
function into dispatch
and dispatch*
.
Added locate-commands
, for when invoking dispatch*
directly.
Detect command name conflicts when locating commands.
Added :summary to interface.
Initial release.