Module: Zedkit::CLI

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

Overview

Copyright © Zedkit.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Defined Under Namespace

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

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"
    }
  }
}
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



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

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

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



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

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



61
62
63
64
65
# File 'lib/zedkit/cli/text.rb', line 61

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



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

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