Sha256: 460e333fa9103499adcc636590a8d445cb30511d332dc6bbc0f156eebfc658ff
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
module Kontena # Run a kontena command like it was launched from the command line. # # @example # Kontena.run("grid list --help") # # @param [String] command_line # @return [Fixnum] exit_code def self.run(cmdline = "", returning: :status) require 'shellwords' result = Kontena::MainCommand.new(File.basename(__FILE__)).run(cmdline.shellsplit) return 0 if returning == :status return result if returning == :result rescue SystemExit returning == :status ? $!.status : nil end def self.version "kontena-cli/#{Kontena::Cli::VERSION}" end def self.pastel @pastel ||= Pastel.new(enabled: $stdout.tty?) end def self.prompt @prompt ||= TTY::Prompt.new( active_color: :cyan, help_color: :white, error_color: :red, interrupt: :exit, prefix: pastel.green('> ') ) end def self.root File.dirname(__dir__) end end # Monkeypatching string to mimick 'colorize' gem class String def colorize(color_sym) ::Kontena.pastel.send(color_sym, self) end end require 'ruby_dig' require_relative 'kontena/cli/version' require_relative 'kontena/cli/common' require_relative 'kontena/command' require_relative 'kontena/client' require_relative 'kontena/plugin_manager' require_relative 'kontena/main_command' require_relative 'kontena/cli/spinner'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kontena-cli-0.16.0.pre1 | lib/kontena_cli.rb |