CLI tools

CLI tools provide facilities for the command line interface development

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

ru.d-shap
ArtifactId

ArtifactId

cli
Last Version

Last Version

1.2
Release Date

Release Date

Type

Type

jar
Description

Description

CLI tools
CLI tools provide facilities for the command line interface development
Project URL

Project URL

https://github.com/d-shap/cli
Source Code Management

Source Code Management

https://github.com/d-shap/cli

Download cli

How to add to project

<!-- https://jarcasting.com/artifacts/ru.d-shap/cli/ -->
<dependency>
    <groupId>ru.d-shap</groupId>
    <artifactId>cli</artifactId>
    <version>1.2</version>
</dependency>
// https://jarcasting.com/artifacts/ru.d-shap/cli/
implementation 'ru.d-shap:cli:1.2'
// https://jarcasting.com/artifacts/ru.d-shap/cli/
implementation ("ru.d-shap:cli:1.2")
'ru.d-shap:cli:jar:1.2'
<dependency org="ru.d-shap" name="cli" rev="1.2">
  <artifact name="cli" type="jar" />
</dependency>
@Grapes(
@Grab(group='ru.d-shap', module='cli', version='1.2')
)
libraryDependencies += "ru.d-shap" % "cli" % "1.2"
[ru.d-shap/cli "1.2"]

Dependencies

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
ru.d-shap : assertions jar 2.0

Project Modules

There are no modules declared in this project.

CLI tools

CLI tools provide facilities for the command line interface development.

Command line interface can be defined as a command flow. The commands in this flow are executed step by step.

The command implementation class should extend the AbstractCommand class or it's subclasses. Each command performs some actions and then defines the next command based on this actions. This is the command flow.

The CommandRunner class is used to run the command flow. This class obtains the first command in the flow and executes all the commands in this flow.

Some commands require user interaction, some does not. For example, the application first collects the required data from the user and then performs some actions based on this data.

Commands, that require the user interaction, should extend the AbstractUserActionCommand class or it's subclasses. Some useful subclasses are AbstractMenuCommand to define the menu, AbstractInputCommand to obtain the data from the user like strings, numbers etc.

Commands, that does not require the user interaction, should extend the AbstractExecutionCommand class or it's subclasses.

All the commands in the flow share the same context. One command in the flow can put the value to the context, another command can use this value to perform some actions.

The command flow can contain nested flows. Nested flow has the nested context. All the commands of the nested flow share the same nested context, but nested flow does not affect the parent context.

The nested flow is defined by the class, that extends the AbstractContainerCommand.

Latest release

CLI tools:

  • <groupId>: ru.d-shap
  • <artifactId>: cli
  • <version>: 1.2

Donation

If you find my code useful, you can bye me a coffee

Versions

Version
1.2
1.1
1.0