module Amigrind::CLI

Constants

BLUEPRINTS
BUILD
ENVIRONMENTS
INVENTORY
REPO
ROOT

credentials = Amigrind::Core::CredentialsHelper.from_cli_options(options)

Public Class Methods

blueprint_options(cmd) click to toggle source
# File lib/amigrind/cli/_helpers.rb, line 22
def blueprint_options(cmd)
  cmd.option  nil, :blueprint,
              'name of the blueprint in the Amigrind repo',
              argument: :required
end
channel_options(cmd) click to toggle source
# File lib/amigrind/cli/_helpers.rb, line 28
def channel_options(cmd)
  cmd.option  nil, :channel,
              'channel to use, from the selected Amigrind environment',
              argument: :required
end
environment_name_parse(opts) click to toggle source
# File lib/amigrind/cli/_helpers.rb, line 34
def environment_name_parse(opts)
  opts[:environment] ||
    (Amigrind::Config['amigrind'] || {})['default_environment'] ||
    'default'
end
environment_options(cmd) click to toggle source
# File lib/amigrind/cli/_helpers.rb, line 16
def environment_options(cmd)
  cmd.option  nil, :environment,
              'name of the environment in the Amigrind repo',
              argument: :required
end
output_format_options(cmd) click to toggle source
# File lib/amigrind/cli/_helpers.rb, line 4
def output_format_options(cmd)
  cmd.option  :f, :format,
              'output format',
              argument: :required
end
repo_options(cmd) click to toggle source
# File lib/amigrind/cli/_helpers.rb, line 10
def repo_options(cmd)
  cmd.option  nil, :'repo-path',
              'path to the Amigrind repo',
              argument: :required
end
run(args) click to toggle source
# File lib/amigrind/cli.rb, line 8
def self.run(args)
  ROOT.run(args)
end
with_repo_and_env(opts, &block) click to toggle source
# File lib/amigrind/cli/_helpers.rb, line 40
def with_repo_and_env(opts, &block)
  Amigrind::Repo.with_repo(path: opts[:'repo-path']) do |repo|
    env_name = CLI.environment_name_parse(opts)

    block.call(repo, repo.environment(env_name))
  end
end