45. CommandLine

Command line interface for YaST2 modules

45.1. 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

    45.2. Global Functions

    45.2.1. Abort

    Abort the command line handling

    Return value

    • void

    45.2.2. Aborted

    User asked for abort (forgetting the changes)

    Return value

    • boolean - true, if the user asked abort

    45.2.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.

    45.2.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

    45.2.5. Error

    Print an Error Message

    Function parameters

    • string message

    Return value

    • void

    45.2.6. Init

    Initialize Module

    Function parameters

    • map cmdlineinfo

    • list<any> args

    Return value

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

    45.2.7. Interactive

    Is module started in interactive command-line mode?

    Return value

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

    45.2.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.

    45.2.9. PasswordInput

    Read input from command line

    Function parameters

    • string prompt

    Return value

    • string - Entered string

    45.2.10. Print

    Print a String

    Function parameters

    • string s

    Return value

    • void

    45.2.11. PrintNoCR

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

    Function parameters

    • string s

    Return value

    • void

    45.2.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

    45.2.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

    45.2.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

    45.2.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

    45.2.16. StartGUI

    Should module start UI?

    Return value

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

    45.2.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

    45.2.18. UserInput

    Read input from command line

    Function parameters

    • string prompt

    Return value

    • string - Entered string

    45.2.19. Verbose

    Return verbose flag boolean verbose flag

    Return value

    • boolean

    45.2.20. YesNo

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

    Return value

    • boolean - true if user entered "yes"

    45.3. Global Variables

    45.4. Module Requirements

    45.4.1. Module Imports

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

    45.4.2. Module Includes