47. CommandLine

Command line interface for YaST2 modules

47.1. Authors

  • Stanislav Visnovsky <visnov@suse.cz>

47.2. Summary of Module Globals

List of Global Functions

  • Abort - Abort the command line handling

  • Aborted - User asked for abort (forgetting the changes)

  • Command - Get next user-given command

  • Done - Are there some commands to be processed?

  • Error - Print an Error Message

  • Init - Initialize Module

  • Interactive - Is module started in interactive command-line mode?

  • Parse - Parse a list of arguments.

  • PasswordInput - Read input from command line

  • Print - Print a String

  • PrintNoCR - Print a String, don't add a trailing newline character

  • PrintVerbose - Same as Print(), but the string is printed only when verbose command line mode was activated

  • PrintVerboseNoCR - Same as PrintNoCR(), but the string is printed only when verbose command line mode was activated

  • Run - Parse the Command Line

  • Scan - Scan a command line from stdin, return it split into a list

  • StartGUI - Should module start UI?

  • UniqueOption - Check uniqueness of an option

  • UserInput - Read input from command line

  • Verbose - Return verbose flag boolean verbose flag

  • YesNo - Ask user, commandline equivalent of Popup::YesNo()

List of Global Variables

    47.3. Global Functions

    47.3.1. Abort

    Abort the command line handling

    Return value

    • void

    47.3.2. Aborted

    User asked for abort (forgetting the changes)

    Return value

    • boolean - true, if the user asked abort

    47.3.3. Command

    Get next user-given command

    Return value

    • map - of the new command. If there are no more commands, it returns exit or abort depending on the result user asked for.

    See also:

    • Parse

    47.3.4. Done

    Are there some commands to be processed?

    Return value

    • boolean - true, if there is no more commands to be processed, either because the user used command line, or the interactive mode was finished

    47.3.5. Error

    Print an Error Message

    Function parameters

    • string message

    Return value

    • void

    47.3.6. Init

    Initialize Module

    Function parameters

    • map cmdlineinfo

    • list<any> args

    Return value

    • boolean - true, if there are some commands to be processed

    See also:

    • Command

    47.3.7. Interactive

    Is module started in interactive command-line mode?

    Return value

    • boolean - true, if the user asked for interactive command-line mode

    47.3.8. Parse

    Parse a list of arguments.

    Function parameters

    • list<any> arguments

    Return value

    • map<string, any> - containing the command and it's option. In case of error it is an empty map.

    47.3.9. PasswordInput

    Read input from command line

    Function parameters

    • string prompt

    Return value

    • string - Entered string

    47.3.10. Print

    Print a String

    Function parameters

    • string s

    Return value

    • void

    47.3.11. PrintNoCR

    Print a String, don't add a trailing newline character

    Function parameters

    • string s

    Return value

    • void

    47.3.12. PrintVerbose

    Same as Print(), but the string is printed only when verbose command line mode was activated

    Function parameters

    • string s

    Return value

    • void

    47.3.13. PrintVerboseNoCR

    Same as PrintNoCR(), but the string is printed only when verbose command line mode was activated

    Function parameters

    • string s

    Return value

    • void

    47.3.14. Run

    Parse the Command Line

    Function parameters

    • map commandline

    Return value

    • any - 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

    47.3.15. Scan

    Scan a command line from stdin, return it split into a list

    Return value

    • list<string> - the list of command line parts, nil for end of file

    47.3.16. StartGUI

    Should module start UI?

    Return value

    • boolean - true, if the user asked for standard UI (no parameter was passed by command line)

    47.3.17. UniqueOption

    Check uniqueness of an option

    Function parameters

    • map<string, string> options

    • list unique_options

    Return value

    • string - nil if there is a problem, otherwise the unique option found

    47.3.18. UserInput

    Read input from command line

    Function parameters

    • string prompt

    Return value

    • string - Entered string

    47.3.19. Verbose

    Return verbose flag boolean verbose flag

    Return value

    • boolean

    47.3.20. YesNo

    Ask user, commandline equivalent of Popup::YesNo()

    Return value

    • boolean - true if user entered "yes"

    47.4. Global Variables

    47.5. Module Requirements

    47.5.1. Module Imports

    • Directory
    • Mode
    • Report
    • RichText
    • RichText
    • Stage
    • String
    • TypeRepository
    • XML

    47.5.2. Module Includes