Method: Yast::CommandLineClass#main

Defined in:
library/commandline/src/modules/CommandLine.rb

#mainObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'library/commandline/src/modules/CommandLine.rb', line 34

def main
  Yast.import "Directory"
  Yast.import "Mode"
  Yast.import "Popup"
  Yast.import "Report"
  Yast.import "Stage"
  Yast.import "String"
  Yast.import "Integer"
  Yast.import "TypeRepository"
  Yast.import "XML"

  textdomain "base"

  @cmdlineprompt = "YaST2 > "

  # Map of commands for every module. ATM the list of commands this module handles internally.
  @systemcommands = {
    "actions"  => {
      "help"        => {
        # translators: help for 'help' option on command line
        "help"     => _(
          "Print the help for this module"
        ),
        "readonly" => true
      },
      "longhelp"    => {
        # translators: help for 'longhelp' option on command line
        "help"     => _(
          "Print a long version of help for this module"
        ),
        "readonly" => true
      },
      "xmlhelp"     => {
        # translators: help for 'xmlhelp' option on command line
        "help"     => _(
          "Print a long version of help for this module in XML format"
        ),
        "readonly" => true
      },
      "interactive" => {
        # translators: help for 'interactive' option on command line
        "help"     => _(
          "Start interactive shell to control the module"
        ),
        # interactive mode itself does not mean that write is needed.
        # The first action that is not readonly will switch flag.
        "readonly" => true
      },
      "exit"        => {
        # translators: help for 'exit' command line interactive mode
        "help"     => _(
          "Exit interactive mode and save the changes"
        ),
        "readonly" => true
      },
      "abort"       => {
        # translators: help for 'abort' command line interactive mode
        "help"     => _(
          "Abort interactive mode without saving the changes"
        ),
        "readonly" => true
      }
    },
    "options"  => {
      "help"    => {
        # translators:  command line "help" option
        "help" => _(
          "Print the help for this command"
        )
      },
      "verbose" => {
        # translators: command line "verbose" option
        "help" => _(
          "Show progress information"
        )
      },
      "xmlfile" => {
        # translators: command line "xmlfile" option
        "help" => _(
          "Where to store the XML output"
        ),
        "type" => "string"
      }
    },
    "mappings" => {
      "help"        => ["help", "verbose"],
      "xmlhelp"     => ["help", "verbose", "xmlfile"],
      "interactive" => ["help", "verbose"],
      "exit"        => ["help"],
      "abort"       => ["help"]
    }
  }

  # Map of commands defined by the YaST2 module.
  @modulecommands = {}

  # Merged map of commands - both defined by the YaST2 module and system commands. Used for lookup
  @allcommands = deep_copy(@systemcommands)

  # User asked for interactive session
  @interactive = false

  # All commands have been processed
  @done = false

  # User asked for quitting of interactive session, or there was an error
  @aborted = false

  # a cache for already parsed but not processed command
  @commandcache = {}

  # Verbose mode flag
  @verbose = false

  # Remember the command line specification for later use
  @cmdlinespec = {}

  # string: command line interface is not supported
  @nosupport = _(
    "This YaST2 module does not support the command line interface."
  )
end