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

Ability to retrieve a populated Command from a string

    Details

    • Type: Feature Request
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 0.66.9
    • Component/s: None
    • Labels:
      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.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                stalep Stale Pedersen
                Reporter:
                jdenise Jean Francois Denise
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: