Method: Yast::CommandLineClass#GetInput

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

#GetInput(prompt, type) ⇒ String

Set prompt and read input from command line

Parameters:

  • prompt (String)

    Set prompt

  • type (Symbol)

    Type

Returns:



1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
# File 'library/commandline/src/modules/CommandLine.rb', line 1276

def GetInput(prompt, type)
  # set the required prompt
  SCR.Write(path(".dev.tty.prompt"), prompt)

  res = case type
  when :nohistory
    Convert.to_string(SCR.Read(path(".dev.tty.nohistory")))
  when :noecho
    Convert.to_string(SCR.Read(path(".dev.tty.noecho")))
  else
    Convert.to_string(SCR.Read(path(".dev.tty")))
  end

  # set the default prompt
  SCR.Write(path(".dev.tty.prompt"), @cmdlineprompt)

  res
end