CLI- Better completion for arguments

Version 4

    Better completion for arguments

     

    Analysis

    Summary

    Use completion to help choose the right arguments/properties to use to compose an operation. This doesn’t apply to command.

    Requirements

    Completion helps understand what are the properties/arguments that can come next. This take into account required and alternatives descriptors. The full spec is detailed in the Design Notes.

    Design Notes

    CLI operation arguments and complex object properties completion

     

    Completion is initiated by pressing <TAB>.

    Operation arguments and complex properties are handled in the same way.

    A "present property" is a property with a value that is present in the user input.

    An "hidden property" is a property that exists in the description but is not exposed to the user in a given context.

    Users are still able to create invalid operations. Completer doesn't validate the operation content, it helps user to build a valid operation.

     

    General rules

    - If a property is present in the user input, it is not proposed .

    - If the radical of a property name is typed, the property name (if it exists, hidden or not) is proposed.

    - If some properties can be added after the last present property, ',' is in-lined.

    - If no more properties can be added after the last present property, ')' or '}' is in-lined.

     

    Required

    - A property with "required"=true or no required attribute is considered as natively required.

    - A property that is referenced by the "requires" of a present property is considered required.

    - A required property with alternatives is treated like any other required property.

    - A required property proposed by the completer inside a list of choices has its name post-fixed with '*'.

    - A required property proposed by the completer as the only choices directly inlined.

     

    Alternatives

    - Properties in an alternatives list have an exclusive relationship.

    - If no properties from the same alternatives are present, all properties from the alternatives are proposed.

    - If a property from an alternative is present, then all other properties from the same alternatives are hidden.

     

    Requires

    - Requires properties from hidden alternatives are hidden.

    - All properties present in the requires list of present properties are exposed and tagged required. This could make hidden requires (attached to hidden alternatives) to become visible.

    - Properties that are alternatives of each others can be present in a requires list. In this case exclusion apply.



    Examples

    A good example to illustrate the completer behavior is the deployment:add operation (considering https://issues.jboss.org/browse/WFCORE-2591 fixed)

     

    /deployment=test.war:add(<TAB>

    content* enabled runtime-name

     

    /deployment=test.war:add(content=[{<TAB>

    archive  bytes*  empty*  hash*  input-stream-index*  path*  relative-to  url*

     

    /deployment=test.war:add(content=[{input-stream-index=zanata.xml<TAB> ==> /deployment=test.war:add(content=[{input-stream-index=zanata.xml}

     

    /deployment=test.war:add(content=[{path=xxx,<TAB>

    archive*  relative-to

     

    /deployment=test.war:add(content=[{relative-to=xxx,<TAB>

    archive  path*

     

    /deployment=test.war:add(content=[{archive=true,<TAB>

    empty*  hash*  path*  relative-to

     

    /deployment=test.war:add(content=[{empty=true,<TAB> ==> /deployment=test.war:add(content=[{empty=true,archive=

     

    /deployment=test.war:add(content=[{empty=true,archive=true<TAB> ==> /deployment=test.war:add(content=[{empty=true,archive=true}

     

    /deployment=test.war:add(content=[{empty=true,archive=true,i<TAB> ==> /deployment=test.war:add(content=[{empty=true,archive=true,input-stream-index

     

    General

    Product Issue(s)

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

    Upstream Issue(s)

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

    Developer Contacts

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