travis 1.9.1.travis.1220.9 → 1.9.1.travis.1223.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/travis/cli/help.rb +33 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6df8f81c7081e2f6b9d6fa0db94b6620bc41954597d6ce4739b8feb3a95351e6
4
- data.tar.gz: 35e0ccc0f7289a4b5801a6dd61b0d65d86762ae80bed233fda1c6cbeb9346971
3
+ metadata.gz: 2968d5c1fb4f1af4325a384ed874cc11b6d82d4c683081b5e395ec44d4cb35af
4
+ data.tar.gz: 55eac4107dbd2ac6eced3680aa02ffc959998f2766005e6de5209c9d3abf9b41
5
5
  SHA512:
6
- metadata.gz: 7ac2f82efed7b59db80a52ff6653fd923ca0eb592888bd7471accba9d003a9ace2d063ac788dfd028003c97d1ce739dc4571110c3980ab4bef1a8c701be34589
7
- data.tar.gz: 9635c0ec68891dbc04fdbaa8d885d2a3bf9eaf965446301ed0bdc6b2cf74f6ee8c96643cea62e299c93f0298ac3ef88ae97432315b4eacccd50b5253522e28ee
6
+ metadata.gz: 1adf47e6106588911cd3feb60994172d9994c417d63fbc47da72cb9e492901ebd3e191e85963f81074a82d5366fc0d1e35b17569d35f71dade9d073b7eef1463
7
+ data.tar.gz: 73194aa9d69b7046b227f69dd07d8b98632a882255cd0e73b6c0f8257a473a1d1f9196315915f11a226fd09834ada37b66ae8e7261edd8509e7e8d88c91c3d1b
@@ -5,18 +5,48 @@ module Travis
5
5
  class Help < Command
6
6
  description "helps you out when in dire need of information"
7
7
 
8
+ CommandGroup = Struct.new(:cmds, :header)
9
+
8
10
  def run(command = nil)
9
11
  if command
10
12
  say CLI.command(command).new.help
11
13
  else
14
+ api_cmds = CommandGroup.new(api_commands, 'API commands')
15
+ repo_cmds = CommandGroup.new(repo_commands, 'Repo commands')
16
+ other_cmds = CommandGroup.new(other_commands, 'non-API commands')
17
+
12
18
  say "Usage: travis COMMAND ...\n\nAvailable commands:\n\n"
13
- commands.each { |c| say "\t#{color(c.command_name, :command).ljust(22)} #{color(c.description, :info)}" }
19
+ [other_cmds, api_cmds, repo_cmds].each do |cmd_grp|
20
+ say " #{cmd_grp.header}"
21
+ cmd_grp.cmds.each do |cmd|
22
+ say " #{color(cmd.command_name, :command).ljust(22)} #{color(cmd.description, :info)}"
23
+ end
24
+ end
14
25
  say "\nrun `#$0 help COMMAND` for more info"
15
26
  end
16
27
  end
17
28
 
18
- def commands
19
- CLI.commands.sort_by { |c| c.command_name }
29
+ def cmd_group_header(title)
30
+ say " #{color(title, :green)}"
31
+ end
32
+
33
+ def api_commands
34
+ CLI.commands.select do |cmd|
35
+ cmd.ancestors.include?(CLI::ApiCommand) &&
36
+ !cmd.ancestors.include?(CLI::RepoCommand)
37
+ end.sort_by {|c| c.command_name}
38
+ end
39
+
40
+ def repo_commands
41
+ CLI.commands.select do |cmd|
42
+ cmd.ancestors.include? CLI::RepoCommand
43
+ end.sort_by {|c| c.command_name}
44
+ end
45
+
46
+ def other_commands
47
+ CLI.commands.select do |cmd|
48
+ !cmd.ancestors.include? CLI::ApiCommand
49
+ end.sort_by {|c| c.command_name}
20
50
  end
21
51
  end
22
52
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1.travis.1220.9
4
+ version: 1.9.1.travis.1223.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiro Asari
@@ -77,7 +77,7 @@ authors:
77
77
  autorequire:
78
78
  bindir: bin
79
79
  cert_chain: []
80
- date: 2020-05-18 00:00:00.000000000 Z
80
+ date: 2020-05-19 00:00:00.000000000 Z
81
81
  dependencies:
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: faraday