Class: CmdList

Inherits:
CmdBase show all
Defined in:
lib/shell.rb

Overview

Command list

Constant Summary collapse

NAME =
'list'
ALIASES =
['l'].freeze
ARGUMENTS =
[].freeze
DESCRIPTION =
'List levels'

Instance Method Summary collapse

Methods inherited from CmdBase

#aliases, #arguments, #description, #initialize, #name

Constructor Details

This class inherits a constructor from CmdBase

Instance Method Details

#exec(_) ⇒ Object



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/shell.rb', line 138

def exec(_)
  @shell.natas.levels.each do |level|
    l = format(
      '%<login>s%<level>d: %<password>s',
      {
        login: NatasLevelBase::LOGIN,
        level: level.level,
        password: level.password
      }
    )
    if level.level == @shell.natas.level
      puts @shell.console.red.bold.on_white(l)
    else
      puts l
    end
  end
end