cmdr::config - Cmdr - (Partially internal) Collection of parameters for privates
Welcome to the Cmdr project, written by Andreas Kupries.
For availability please read Cmdr - How To Get The Sources.
This package implements the collections of cmdr::parameters serving as the configuration of privates (see cmdr::private).
The class API is not public. It is used internally by the framework when parsing a command hierarchy specification to create the necessary configuration 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::config.
Not used.
Create a new instance of cmdr::config, named obj.
The (command) name of the new config instance.
The instance command of the cmdr::private instance the configuration will belong to.
Tcl-script specifying the parameters in detail. Please read Cmdr - Parameter Specification Language for the details.
Class method to change the global interaction default for the mini-shell of privates. The default is to disable this mini-shell for all privates, and enable it on a per-private basis, through the specification.
Defaults to true, globally activating the mini-shell.
Class method to override the standard display command used by the mini-shell to show the current state of all parameters.
The display command to use. The command will be called with a single argument, a list containing the names of the parameters to show. The command has to format the state of the requested parameters as a string and return this string as its result.
Most of the instance API is not public.
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.
All parameters held by a configuration instance are accessible through it. To this end each parameter named foo has a dynamically created accessor method @foo taking the method and its arguments to apply to the parameter instance.
If no words are specified at all the system defaults to the application of instance method value.
Together with a parameter's ability to access the configuration holding it having access to a single parameter instance (like in the various callbacks) provides access to all.
This method returns a list of parameter names, for the parameters which are arguments.
This method is part of the mini shell command line completion. For the details of its workings please read Cmdr - Internals of command line completion.
This hook-method, the entrypoint for the repl is responsible for computing the set of completions for the entered line.
The command line to complete.
This internal method is part of the mini shell command line completion. For the details of its workings please read Cmdr - Internals of command line completion.
It is used by the hook-method complete (see above). 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 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 hook-method for the mini-shell is responsible for the detection of a continuation-line in the entered command line. It always returns the boolean value false as the mini-shell does not support continuation lines.
This hook-method for the mini-shell is responsible for the recognition and execution of the supported commands.
The command line containing the command to run.
This method formats the chosen parameters for display and returns the result as a string. This invokes the chosen display callback, if one was set. Without an internal formatter is used instead.
The list of parameters (by name) to format for display. If not specified the list default to the set of public parameters plus any undocumented parameters already set by the user.
This method formats all parameters for display, using the internal formatter, and returns the result as a string. Useful for debugging.
This method returns a dictionary mapping all possible option prefixes to a list of full option names with that prefix.
This hook-method for the mini-shell returns a boolean value indicating whether the mini-shell was stopped and has to exit (true), or not (false).
This method forces the calculation of the values for all parameters in the configuration instance. This is the ''completion phase''.
If specified as false parameters allowing the interactive entry of their value have this feature disabled for the operation. The default is true, allowing for the interaction.
If specified as true even parameters marked as "defered" are forced to generate their value. The default is false, causing the method to ignore such parameters.
This method invokes the parameter method forget on all parameters in the configuration.
This method checks if the configuration instance contains a parameter with the specified name and returns a boolean value indicating whether the parameter exists (true), or not (false).
The name of the parameter to check for existence
This method returns the help information for the parameters held in the configuration. The result of the command is a structure of the form described in section Help Information.
The possible modes are public and interact. If not specified public is the default. In this mode only "documented" parameters are included in the help. In mode "interact", used by the mini-shell undocumented parameters are included as well, if they are already set by the user.
This method invokes the mini-shell for interactive parameter entry. It returns on exit from the shell. The result of the method is the empty string.
This accessor method returns a boolean value indicating whether use of the mini-shell is allowed (true), or not (false).
This method checks if the configuration instance contains a parameter with the specified name and returns its instance. An error is thrown if the parameter is not known.
The name of the parameter to retrieve.
This method checks if the configuration instance contains a parameter controlling the specified option name and returns its instance. An error is thrown if the option is not known.
The option flag to find the controlling parameter for.
This method throws the standard error for when the option name requiring an argument value does not have one. See the methods notEnough and tooMany as well.
The flag triggering the error.
This method returns a list of parameter names, for all parameters.
This method throws the standard error for when a command is found to be supplied with not enough arguments for its parameters. See the methods missingOptionValue and tooMany as well.
This method returns a list of the option flags recognized by the parameters in the configuration. This does not include option prefixes.
This method parses the words (from the command line) and maps them to parameters, based on naming (options and flags), or position (arguments).
The words of the command specifying the parameters of the private holding the configuration instance.
This method is a helper for parse above. Accessing the internal queue initialized by parse it splits arguments and options, processing all the latter. The arguments are put back into the queue, in the order they were found in. This is used by parameters (optional arguments) using the regular threshold-regime to determine acceptance. All options still in the command line must be removed (and processed) to know the proper number of arguments words left.
This hook-method for the mini-shell returns the primary prompt string to use.
This hook-method for the mini-shell returns the secondary prompt string for use within a continuation. As the mini-shell does not support continuation lines it should not be invoked ever, and thus always throws an error should it be invoked.
This method a list of parameter names, for all documented option and argument parameters.
This method is a helper for methods tooMany, notEnough, and missingOptionValue, doing the bulk of the work.
The human-readable error message to use.
The machine-readable (trap-able) error code to use.
This hook-method for the mini-shell is responsible for the reporting of the command results and handles the display of the parameter state before a new prompt.
Its result is the empty string.
The result code of the command, one of ok, or fail.
The result of the command, or an error message in case of failure.
This method invokes the parameter method reset on all parameters in the configuration.
This method returns the configuration instance itself.
This method throws the standard error for when a command is found to be supplied with too many arguments for its parameters. See the methods missingOptionValue and notEnough as well.
This method is the hook into the TclOO method resolution for the class. It implements the dynamic accessor methods for the parameters held by the configuration instance. See method @... at the top.
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 Andreas Kupries
Copyright © 2013 Documentation, Andreas Kupries