Uploaded image for project: 'Aesh'
  1. Aesh
  2. AESH-393

Ability to retrieve a populated Command from a string

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Major
    • 0.66.9
    • None
    • None
    • None

    Description

      Some commands are manipulating Command as values e.g.: echo-dmr ls -l
      The Command echo-dmr would need an API to:

      • retrieve a populated command. Today this can (nearly) be done the following way:
        CommandContainer<Command> container = registry.getCommand(opName, originalInput);
        CommandLine line = container.getParser().parse(originalInput, false);
        line.getParser().getCommandPopulator().populateObject(line, commandInvocation.getInvocationProviders(), commandInvocation.getAeshContext(), true);
        Command c = line.getParser().getCommand();

      You will notice that commandInvocation.getInvocationProviders() is not today exposed by the AeshConsole,

      2 possible API:

      • Simply expose the InvocationProviders in the AeshConsole.
      • Or expose a new method Command getPopulatedCommand(String commandLine) in the CommandInvocation interface.

      I would vote for the method that hides the detail of how the parsing is operated.

      Attachments

        Activity

          People

            spederse@redhat.com Stale Pedersen
            jdenise@redhat.com Jean Francois Denise
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: