Class: Agile::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/agile.rb,
lib/agile/commands/help.rb,
lib/agile/commands/hello.rb,
lib/agile/commands/login.rb,
lib/agile/commands/values.rb,
lib/agile/commands/version.rb,
lib/agile/commands/principles.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.help(shell, subcommand = false) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/agile/commands/help.rb', line 6

def help(shell, subcommand = false)
  list = printable_commands(true, subcommand)
  Thor::Util.thor_classes_in(self).each do |klass|
    list += klass.printable_commands(false)
  end
  list.sort! { |a, b| a[0] <=> b[0] }
  list.reject! { |l| l[0].split[1] == "help" }

  if defined?(@package_name) && @package_name
    shell.say "#{@package_name} commands:"
  else
    shell.say Rainbow("Commands:").whitesmoke
  end

  shell.print_table(list, indent: 2, truncate: true)
  shell.say
  class_options_help(shell)
  shell.say Rainbow("All commands can be run with -h (or --help) for more information.").whitesmoke
end

Instance Method Details

#helloObject



4
5
6
# File 'lib/agile/commands/hello.rb', line 4

def hello
  say "Hello world!"
end

#login(username) ⇒ Object



5
6
7
# File 'lib/agile/commands/login.rb', line 5

def (username)
  run %{`which curl` -u #{username} #{GITHUB_URL} }
end

#principlesObject



4
5
6
# File 'lib/agile/commands/principles.rb', line 4

def principles
  say File.read("#{`gem which agile`.chomp.chomp('agile.rb')}/agile/agile_principles.txt")
end

#valuesObject



4
5
6
# File 'lib/agile/commands/values.rb', line 4

def values
  say File.read("#{`gem which agile`.chomp.chomp('agile.rb')}/agile/agile_values.txt")
end

#versionObject



4
5
6
# File 'lib/agile/commands/version.rb', line 4

def version
  say "agile #{Agile::VERSION}"
end