Module: Zedkit::CLI

Defined in:
lib/zedkit/cli/text.rb,
lib/zedkit/cli/users.rb,
lib/zedkit/cli/bottom.rb,
lib/zedkit/cli/runner.rb,
lib/zedkit/cli/projects.rb,
lib/zedkit/cli/exceptions.rb

Defined Under Namespace

Classes: Bottom, CommandLineError, MissingCredentials, MissingParameter, Projects, Runner, UnknownCommand, Users

Constant Summary collapse

LOCALES =
%w(en).freeze
CONTENT =
{
  :en => {
    :commands => {
      :projects => "Project Commands",
      :projects_list => "List Zedkit projects",
      :projects_show => "Show Zedkit project details",
      :projects_create => "Create a new Zedkit project",
      :projects_update => "Update an existing Zedkit project",
      :projects_delete => "Delete an existing Zedkit project",
      :users_list => "List a project's users",
      :users_show => "Show user details",
      :users_create => "Create a new user",
      :users_update => "Update an existing user",
      :users_delete => "Delete an existing user"
    }
  }
}
ERRORS =
{
  :en => {
    :runner => {
      :credentials => "Missing Zedkit Credentials",
      :zedkit_file => "Missing Zedkit Credentials in ~/.zedkit"
    },
    :general => {
      :error => "Zedkit CLI ERROR.",
      :message => "Message",
      :section => "Unknown Section",
      :unknown => "Unknown Command",
      :not_done => "This operation is not yet implemented."
    },
    :project => {
      :nil => "Project UUID is nil"
    }
  }
}.freeze

Class Method Summary collapse

Class Method Details

.ee(locale, key, item) ⇒ Object



24
25
26
# File 'lib/zedkit/cli/text.rb', line 24

def ee(locale, key, item)
  Zedkit::CLI.lookup_ee("Zedkit::CLI", locale, key, item)
end

.lookup_ee(ch, locale, key, item) ⇒ Object



72
73
74
75
76
# File 'lib/zedkit/cli/text.rb', line 72

def lookup_ee(ch, locale, key, item)
  rs = lookup(eval("#{ch}::ERRORS"), locale, key, item)
  rs = lookup(eval("Zedkit::CLI::ERRORS"), locale, key, item) if rs.nil?
  rs
end

.lookup_tt(ch, locale, key, item) ⇒ Object



67
68
69
70
71
# File 'lib/zedkit/cli/text.rb', line 67

def lookup_tt(ch, locale, key, item)
  rs = lookup(eval("#{ch}::CONTENT"), locale, key, item)
  rs = lookup(eval("Zedkit::CLI::CONTENT"), locale, key, item) if rs.nil?
  rs
end

.tt(locale, key, item) ⇒ Object



21
22
23
# File 'lib/zedkit/cli/text.rb', line 21

def tt(locale, key, item)
  Zedkit::CLI.lookup_tt("Zedkit::CLI", locale, key, item)
end