cmdr::private - Cmdr - (Internal) Single command handling, options, and arguments
Welcome to the Cmdr project, written by Andreas Kupries.
For availability please read Cmdr - How To Get The Sources.
This package implements privates, the leaves of command hierarchies. While each private can execute only a single action they have parameters, i.e. arguments and options with which to configure the behaviour of their action.
This class is sub-class of cmdr::actor.
The class API is not public. It is used internally by the framework when parsing a command hierarchy specification to create the necessary private instances.
It is described here for use by developers maintaining, modifying and extending the framework itself. A user of the framework has no need for it.
Create an auto-named instance of cmdr::private.
Not used.
Create a new instance of cmdr::private, named obj. Used by the DSL processing parts of the framework to instantiate privates.
The instance command of the actor (officer actually) which contains the new private.
The user-visible name of the command.
The specification of the private's parameters. Please read Cmdr - Parameter Specification Language for the details.
The command prefix to invoke when this private is selected for execution. It takes a single argument, the instance command of the hidden cmdr::config container holding the private's parameters. The result of the action, if there is any, is ignored by the framework.
The instance API is not public. It is used internally by the framework during the parsing of a command hierarchy specification to configure the private instances, and when processing a command line at runtime to manage word-completion, etc.
It is described here for use by developers maintaining, modifying and extending the framework itself. A user of the framework has no need for it, although they have indirect access through parameters and their container.
This method is part of the main shell command line completion. For the details of its workings please read Cmdr - Internals of command line completion.
Given the completion state parse of a partial command line it returns a list of strings which are the valid completions at this point.
A dictionary holding the current completion state of a partial command line.
This method parses the words of the command line, matching them to the parameters of the private, be they arguments, or options. When done without error it invokes the action of the private with the filled container of parameters.
The words of the command line to parse and match to parameters.
Note: While the form ehandler is still usable, it is deprecated and will be removed in a future release. This method specifies a command prefix to wrap around the parsing of the command line for the private, and the execution of its action.
A command prefix taking a single argument, a script. The command prefix has to execute this script in its caller's context. The script will parse words for the private,m and perform its action. The command prefix then has the responsbility to perform any custom cleanup action required by the application using the framework to prevent leakage of data between multiple commands executed one after the other (i.e. in an interactive shell run by the framework).
This method specifies a command prefix which will be run all the regular setup of an officer from its specification is done, to perform customizations.
The <private> here ignores such calls.
The method exists only to avoid having to special-case code the places propagating these commands down the hierarchy.
This method returns the instance command of the sub-ordinate with the given path of names. An error is thrown if such a sub-ordinate does not exist, i.e. whenever path is not empty, as a private has no sub-ordinates, ever.
Note, as implied above, an empty path is allowed and refers to the private itself.
See also method find of cdmr::officer for the high-end of the recursion which may end in this method.
The path of names to the sub-ordinate to look for.
This method returns the help information for the private and its parameters. The prefix, if specified provides the name of the private within the help data. It defaults to the empty string. The result of the command is a structure of the form described in section Help Information.
The name to use for the private within the generated help.
This method overrides the standard behaviour for unknown methods. Instead of throwing an error they are routed to the hidden container of the private's parameters, of class cmdr::config.
The name of the unknown method.
The argument (one or more) of the unknown method.
The help information generated by various places of the framework is a dictionary containing the following keys:
A list of strings, the names of the command arguments, in order. These names are keys into the parameters sub-dictionary.
The command's description, i.e. help text.
A dictionary mapping option flags to option names. These names are keys into the parameters sub-dictionary.
A dictionary mapping option names to their descriptions.
A dictionary mapping parameter names to their definition. Each definition is a dictionary containing the keys below. See also package cmdr::parameter.
Output of method cmdline.
Output of method code.
Output of method default.
Output of method defered.
Output of method description.
Output of method documented.
A dictionary mapping flag names to flag types, i.e. primary, alias, or inverted.
Output of method generator.
Output of method interactive.
Output of method isbool.
Output of method label.
Output of method list.
Output of method ordered.
Output of method presence.
Output of method prompt.
Output of method required.
Output of method threshold.
Output of method type.
Output of method validator.
A list of sections the command belongs to. Each section name is a list itself, the path of the section and sub-sections.
A list of strings, the names of the command's hidden state parameters. These names are keys into the parameters sub-dictionary.
Both the package(s) and this documentation will undoubtedly contain bugs and other problems. Please report such at Cmdr Tickets.
Please also report any ideas you may have for enhancements of either package(s) and/or documentation.
arguments, command hierarchy, command line completion, command line handling, command tree, editing command line, help for command line, hierarchy of commands, interactive command shell, optional arguments, options, parameters, processing command line, tree of commands
Copyright © 2013-2016 Andreas Kupries
Copyright © 2013-2016 Documentation, Andreas Kupries