Package com.codename1.cli
Command-line applications: picocli-style annotations that the build turns into a parser, with help, version, subcommands and exit codes.
A class annotated CommandLine.Command is a command; its
fields annotated CommandLine.Option and
CommandLine.Parameters receive the arguments. The build
reads the annotations, generates the code that binds them and writes main,
so a command-line tool is a module with commands and nothing else, and it
compiles to a native executable for Linux, macOS and Windows like any
backend.
The same commands work in a backend with controllers. There the server is
the serve subcommand, and the command line with no arguments starts it as
before, so maintenance tasks such as a migration or an administrator account
ship in the server's own binary.
-
ClassDescriptionStyled terminal text, built fluently:A foreground or background color: one of the 16 basic colors, an index into the 256-color palette, or a 24-bit RGB value.What an option and a positional parameter have in common.The code the build generates for one
@Commandclass, through which the parser creates the command, sets its fields and runs it without reflection.Parses a command line into an annotated command and runs it.Marks a command class.Implemented by aRunnablecommand that has an exit code to report.Converts the text of an argument to a type the build does not know.Marks a field that receives an option.A command line that does not parse.Marks a field that receives positional parameters.Marks a field of a subcommand that receives its enclosing command.Starts the server of a backend that also has commands.Marks aCommandSpecfield that receives the command's own model.The model of one command: its name, help text, options, positional parameters and subcommands.What a command needs to know about the terminal it writes to, and the entry point of the console API.How many colors the terminal shows, the levelAnsiconverts colors down to.The stylesConsole.style(String, Console.Style...)can apply.One key press read from a terminal in raw mode, decoded from the bytes and escape sequences terminals send.What was pressed.The last few lines of the terminal, redrawn in place: what progress bars, spinners and prompts are drawn on.Several progress bars drawn together, one line each, for work that runs in parallel:The model of one option, written by the build from anCommandLine.Option.The model of one positional parameter, written by the build from aCommandLine.Parameters.A progress bar with a percentage, a count, a rate and the time left:Questions a command asks the person running it:Thrown when the person cancels a question.Turns a choice into the label a selection list shows.A multiple-choice list with options: labels, preselected choices, limits.A single-choice list with options: labels, a default, page size, filtering.A text question with options: a default, a validator, masking.Checks an answer before a text prompt accepts it.An animated indicator for work of unknown length, ending in a status line:The animation frames.Rows and columns rendered as text, aligned by the columns each cell takes on a terminal, so styled cells, wide characters and emoji line up:How a column's cells line up.The lines drawn around and between cells.A hierarchy rendered the waytreeprints a directory: