Class: S7::S7Cli::LockCommand
- Defined in:
- lib/s7/s7cli/command.rb
Overview
スクリーンロックし、マスターキーを入力するまでは操作できないようにするコマンドを表現する。
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
Methods inherited from Command
#aliases, create_instance, #description, #help, #initialize, #name, #option_parser, split_name_and_argv, #usage
Methods included from GetText
#N_, #_, bindtextdomain, included
Constructor Details
This class inherits a constructor from S7::S7Cli::Command
Instance Method Details
#run(argv) ⇒ Object
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/s7/s7cli/command.rb', line 170 def run(argv) system("clear") puts(_("Locked screen.")) world.save prompt = _("Enter the master key for s7: ") begin input = S7Cli.input_string_without_echo(prompt) if input != world.master_key raise InvalidPassphrase end puts(_("Unlocked.")) return true rescue Interrupt rescue ApplicationError => e puts($!. + _("Try again.")) retry rescue Exception => e puts(e.) puts("----- back trace -----") e.backtrace.each do |line| puts(" #{line}") end end puts(_("Quit.")) return false end |