Class Subcommand

java.lang.Object
com.j3d.engine.interact.cmd.base.Command
com.j3d.engine.interact.cmd.args.Subcommand
All Implemented Interfaces:
Argument
Direct Known Subclasses:
AbstractTransform, AreaCmd, CameraInfoCmd, CopyCmd, DistanceCmd, EchoCmd, EndCmd, ExitCmd, FilesCmd, LineJoin, ListCmd, LookAtCmd, OrbitCmd, PasteCmd, QuickTranslateCmd, RandomUUIDCmd, RecordCmd, RunCmd, TeleportCmd, TestCmd, ToggleCmd, ToggleVisCmd, TriangleCmd, TypeOf, VolumeCmd

public class Subcommand extends Command implements Argument
Represents a command that is nested within another command, acting as both a Command in its own right and as an Argument to its parent command.

This class enables the creation of hierarchical command structures, such as git commit -m "message". In this example, commit would be a Subcommand of the main git command.

By default, a subcommand is considered a non-optional argument to its parent.

Author:
Lehlogonolo Poole
See Also:
  • Constructor Details

    • Subcommand

      public Subcommand(String name, String description)
      Constructs a new Subcommand.
      Parameters:
      name - The primary name of the subcommand.
      description - A user-friendly description of what the subcommand does.
  • Method Details

    • getName

      public String getName()
      Returns the primary name of this subcommand.
      Specified by:
      getName in interface Argument
      Returns:
      The first alias, which is considered the primary name.
    • getDescription

      public String getDescription()
      Returns the description of this subcommand.
      Specified by:
      getDescription in interface Argument
      Returns:
      The user-friendly description.
    • isOptional

      public boolean isOptional()
      Specifies that this subcommand is a required argument for its parent command.
      Specified by:
      isOptional in interface Argument
      Returns:
      always false, as subcommands are not optional.