class Terjira::BaseCLI

Public Class Methods

banner(command, _namespace = nil, _subcommand = false) click to toggle source
subcommand_prefix() click to toggle source
# File lib/terjira/base_cli.rb, line 21
def self.subcommand_prefix
  self.name.gsub(%r{.*::}, '').gsub("CLI", '').gsub(%r{^[A-Z]}) { |match| match[0].downcase }.gsub(%r{[A-Z]}) { |match| "-#{match[0].downcase}" }
end

Public Instance Methods

current_username() click to toggle source
# File lib/terjira/base_cli.rb, line 26
def current_username
  @current_username ||= Client::Base.username
end
open_url(url) click to toggle source
# File lib/terjira/base_cli.rb, line 30
def open_url(url)
  open_cmd = case RUBY_PLATFORM
             when /darwin/ then 'open'
             when /cygwin/ then 'cygstart'
             when /linux/ then 'xdg-open'
             when /msys/ then 'start ""'
             else nil
             end

  if open_cmd
    `#{open_cmd} #{url}`
  else
    puts "#{RUBY_PLATFORM} is not supported"
  end
end