Annotation Interface Command


@Retention(RUNTIME) @Target({TYPE,METHOD}) @Documented @Reflective public @interface Command
Annotation marking a method to be a candicate for a shell command target.
  • Element Details

    • command

      String[] command
      Define command as an array. Given that command should be command1 sub1 it can be defined as:
       command = { "command1", "sub1" }
       command = "command1 sub1"
       
      Values are split and trimmed meaning spaces doesn't matter.

      Supported at the type level as well as at the method level! When used at the type level, all method-level mappings inherit this primary command to use it as a prefix.

       @Command(command = "command1")
       class MyCommands {
      
         @Command(command = "sub1")
         void sub1(){}
       }
       
      Returns:
      the command as an array
      Default:
      {}
    • alias

      String[] alias
      Define alias as an array. Given that alias should be alias1 sub1 it can be defined as:
       alias = { "alias1", "sub1" }
       alias = "alias1 sub1"
       
      Values are split and trimmed meaning spaces doesn't matter.

      Supported at the type level as well as at the method level! When used at the type level, all method-level mappings inherit this primary alias to use it as a prefix.

       @Command(alias = "alias1")
       class MyCommands {
      
         @Command(alias = "sub1")
         void sub1(){}
       }
       
      Returns:
      the aliases as an array
      Default:
      {}
    • group

      String group
      Define a command group.

      Supported at the type level as well as at the method level! When used at the type level, all method-level group inherit this primary group. Can be overridden on method-level.

      Returns:
      the command group
      Default:
      ""
    • description

      String description
      Define a command description.

      Supported at the type level as well as at the method level! When used at the type level, all method-level descriptions inherit this primary field. Can be overridden on method-level.

      Returns:
      the command description
      Default:
      ""
    • hidden

      boolean hidden
      Define command to be hidden.

      Supported at the type level as well as at the method level! When used at the type level, all method-level mappings inherit this primary hidden field.

       @Command(hidden = true)
       class MyCommands {
      
         @Command
         void sub1(){
           // sub1 command is hidden
         }
       }
       
      Returns:
      true if command should be hidden
      Default:
      false
    • interactionMode

      InteractionMode[] interactionMode
      Define interaction mode for a command as a hint when command should be available. For example presense of some commands doesn't make sense if shell is running as non-interactive mode and vice versa.

      Supported at the type level as well as at the method level! When used at the type level, all method-level mappings inherit this primary field. Type is an array to be able to indicate that default don't have anyting defined.

      Returns:
      interaction modes
      Default:
      {}