CLI - commands management

Version 3

    CLI commands management

     

    Analysis

    Summary

    With the evolution of CLI to support aesh 1.0 commands, we have new use cases that CLI needs to handle. For example, to take benefit of third-party aesh commands (eg: aesh-extensions), the CLI must be able to load commands dynamically.

    Currently it is difficult or impossible to achieve the following use cases:

    • List all commands
    • List enabled commands
    • List disabled commands
    • List deprecated commands
    • List commands that are loaded from extensions
    • Display errors that occurred loading commands
    • List commands loaded from ServiceLoader
    • Load commands dynamically from a jar
    • Load commands dynamically from a module

     

    Requirements

    Loading of commands from jar and module applies only to aesh Commands packaged in way that make them discoverable.We plan to define a new command named “commands” with the following actions:

    • display-errors: display errors that could have occured at CLI start time.
    • list-all: display all command names.
    • list-available: display all available commands.
    • list-deprecated: display all deprecated commands
    • list-extensions: display commands loaded from extensions
    • list-plugins: display commands loaded from third party jars and modules
    • list-unavailable: display commands that are not available
    • load-jar-plugins: Load commands from a given jar path
    • load-module-plugins: Load commands from a given module path


    The help --commands will be deprecated.

    Design Notes

    All list-XXX actions, come with a -l option to tune display.load-jar-plugins command options and arguments:

    • Jar file path unnamed argument
    • --command-names to load only a subset of the available commands
    • --name-mapping to resolve name conflicts that could exist with CLI exiting commands (eg: aesh-extensions has a cd and pwd command to interact with the filesystem that conflict with CLI ones).

    Completion for jar file path and command names will be offered.
    load-module-plugins command options and arguments:

    • Root module directory path unnamed argument
    • --name to identify the module to load
    • --command-names to load only a subset of the available commands
    • --name-mapping to resolve name conflicts that could exist with CLI exiting commands (eg: aesh-extensions has a cd and pwd command to interact with the filesystem that conflict with CLI ones).

    Completion for module file path and command names will be offered.

     

    General

    Product Issue(s)

    https://issues.jboss.org/browse/EAP7-742

    Upstream Issue(s)

    https://issues.jboss.org/browse/WFCORE-3222

    Developer Contacts

    Jean-François Denise (jdenise@redhat.com)