yast2 |
modules/CommandLine.ycp |
| Command line interface for YaST2 modules |
|
|
Imports
- Mode
- Progress
- Report
- RichText
- RichText
- Stage
- String
- TypeRepository
Global Functions
Local Variables
Local Functions
|
|
|
|
local systemcommands -> commands_t
|
|
Map of commands for every module. ATM the list of commands this module handles internally.
|
local modulecommands -> map
|
|
Map of commands defined by the YaST2 module.
Merged map of commands - both defined by the YaST2 module and system commands. Used for lookup
|
local interactive -> boolean
|
|
User asked for interactive session
All commands have been processed
User asked for quitting of interactive session, or there was an error
Verbose mode flag
|
global Print (string s) -> void
|
|
Print a String
Print a string to /dev/tty in interactive mode, to stderr in non-interactive
Suppress printing if there are no commands to be handled (starting GUI)
- Parameters:
|
s |
the string to be printed |
|
global PrintVerbose (string s) -> void
|
|
Same as Print(), but the string is printed only when verbose command
line mode was activated
- Parameters:
|
global Error (string message) -> void
|
|
Print an Error Message
- Parameters:
|
message |
error message to be printed. Use nil for no message |
|
global Parse (list<any> arguments) -> map<string, any>
|
|
Parse a list of arguments.
- Parameters:
|
arguments |
the list of arguments to be parsed |
- Return value:
|
|
containing the command and it's option. In case of
error it is an empty map. |
|
local PrintHead () -> void
|
|
Print a nice heading for this module
|
local PrintActionHelp (string action) -> void
|
|
Print a help text for a given action.
- Parameters:
|
action |
the action for which the help should be printed |
|
local PrintGeneralHelp () -> void
|
|
Print a general help - list of available command.
|
local ProcessSystemCommands (map command) -> boolean
|
|
Handle the system-wide commands, like help etc.
- Parameters:
|
command |
a map of the current command |
- Return value:
|
|
true, if the command was handled |
|
global Init (map cmdlineinfo, list<any> args) -> boolean
|
|
Initialize Module
Initialize the module, setup the command line syntax and arguments passed on the command line.
- Parameters:
|
cmdlineinfo |
the map describing the module command line |
|
args |
arguments given by the user on the command line |
- Return value:
|
|
true, if there are some commands to be processed |
- See:
-
|
global Scan () -> list<string>
|
|
Scan a command line from stdin, return it split into a list
- Return value:
|
|
the list of command line parts, nil for end of file |
|
local GetInput (string prompt, symbol type) -> string
|
|
Set prompt and read input from command line
- Parameters:
|
prompt |
Set prompt |
|
type |
Type |
- Return value:
|
global UserInput (string prompt) -> string
|
|
Read input from command line
- Parameters:
|
prompt |
Set prompt to this value |
- Return value:
|
global PasswordInput (string prompt) -> string
|
|
Read input from command line
- Parameters:
|
prompt |
Set prompt to this value |
- Return value:
Get next user-given command
Get next user-given command. If there is a command available, returns it, otherwise ask
the user for a command (in interactive mode). Also processes system commands.
- Return value:
|
|
of the new command. If there are no more commands, it returns exit or abort depending
on the result user asked for.
|
- See:
-
|
global StartGUI () -> boolean
|
|
Should module start UI?
- Return value:
|
|
true, if the user asked for standard UI (no parameter was passed by command line) |
|
global Interactive () -> boolean
|
|
Is module started in interactive command-line mode?
- Return value:
|
|
true, if the user asked for interactive command-line mode |
|
global Aborted () -> boolean
|
|
User asked for abort (forgetting the changes)
- Return value:
|
|
true, if the user asked abort |
Abort the command line handling
|
global Done () -> boolean
|
|
Are there some commands to be processed?
- Return value:
|
|
true, if there is no more commands to be processed, either because the user
used command line, or the interactive mode was finished |
|
global UniqueOption (map<string, string> options, list unique_options) -> string
|
|
Check uniqueness of an option
Check uniqueness of an option. Simply pass the list of user-specified
options and a list of mutually exclusive options. In case of
error, Report::Error is used.
- Parameters:
|
options |
options specified by the user on the command line to be checked |
|
unique_options |
list of mutually exclusive options to check against |
- Return value:
|
|
nil if there is a problem, otherwise the unique option found |
|
global Run (map commandline) -> any
|
|
Parse the Command Line
Function to parse the command line, start a GUI or handle interactive and
command line actions as supported by the @ref CommandLine module.
- Parameters:
|
commandline |
a map used in the CommandLine module with information
about the handlers for GUI and commands. |
- Return value:
|
|
false if there was an error or no changes to be written (for example "help").
true if the changes should be written, or a value returned by the
handler |
|