Details

    • Type: Feature Request
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 1.0.0.Alpha1, 0.66.9
    • Component/s: None
    • Labels:
      None

      Description

      Today it is possible to share a private state between top level commands using Command constructor. For example:

      MySharedState state = ...;
      registry.register(New MyCommand1(state));
      registry.register(New MyCommand2(state));
      registry.register(New MyCommand3(state));

      This is not doable with sub commands. Sub command are created by Aesh Parser generator.

      The only way to do it is via CliCommandInvocation but this makes the private state public (and this is not wanted in my case).

      So I am suggesting to

      • Use the already existing GroupCommand interface (that extends Command interface). It defines the method List<Command> getCommands().
      • Change it to take a parameter.
      • Makes my top level command to implement it and returns the sub commands instances.
      • Make changes to the parser generator to check that the Command to parse is a GroupCommand and is annotated with GroupCommandDescription. If this is one, then call the getCommands method instead of creating them based on the Annotation content.

      This state can be today shared with OptionActivator because the ProcessedCommand is passed along the Activator. For command activator that is not doable. The CommandActivator needs to align with the OptionActivator.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: