commander-openflighthpc 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/commander/command.rb +2 -0
- data/lib/commander/help_formatters/terminal/subcommand_help.erb +1 -1
- data/lib/commander/help_formatters/terminal_compact/subcommand_help.erb +2 -2
- data/lib/commander/patches/priority_sort.rb +21 -0
- data/lib/commander/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2bd1303f7a91cad5cadac934d35ee270a9b2441db7c37685a669b000f8782b5
|
4
|
+
data.tar.gz: '004078c3f1ee373463a37430dbc18207747907e12bc2d4b479903e1f08d1f200'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2a0c2e988bcec7ce6d0a811777588684652b762c3886a4b7bbb25a79443fe924b8d726e6e576734769cbcf852f0bb1200717a5a509c3e25303846228ef28b7e
|
7
|
+
data.tar.gz: b62447900fdf781e69886d657c5470dc59ca935daeee043c08308689f5b7f24375535261f3f28f311754943a8ce8efbaf75d04ac4a0e53430f7dfa9cafeca424
|
data/lib/commander/command.rb
CHANGED
@@ -4,6 +4,7 @@ require 'commander/patches/decimal-integer'
|
|
4
4
|
require 'commander/patches/validate_inputs'
|
5
5
|
require 'commander/patches/option_defaults'
|
6
6
|
require 'commander/patches/help_formatter_binding'
|
7
|
+
require 'commander/patches/priority_sort'
|
7
8
|
|
8
9
|
OptionParser.prepend Commander::Patches::ImplicitShortTags
|
9
10
|
OptionParser.prepend Commander::Patches::DecimalInteger
|
@@ -13,6 +14,7 @@ module Commander
|
|
13
14
|
|
14
15
|
class Command
|
15
16
|
prepend Patches::ValidateInputs
|
17
|
+
prepend Patches::PrioritySort
|
16
18
|
|
17
19
|
attr_accessor :name, :examples, :syntax, :description
|
18
20
|
attr_accessor :summary, :proxy_options, :options, :hidden
|
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
<%= $terminal.color "SUBCOMMANDS", :bold %>:
|
18
|
-
<%
|
18
|
+
<% @commands.values.sort.map { |c| [c.name, c] }.each do |name, command| -%>
|
19
19
|
<% unless alias? name %>
|
20
20
|
<%= "%-#{max_command_length}s %s" % [command.name, command.summary || command.description] -%>
|
21
21
|
<% end -%>
|
@@ -8,8 +8,8 @@
|
|
8
8
|
<%= cmd.description || cmd.summary %>
|
9
9
|
<% end -%>
|
10
10
|
|
11
|
-
<%
|
11
|
+
<% @commands.values.sort.map { |c| [c.name, c] }.each do |name, command| -%>
|
12
12
|
<% unless alias? name -%>
|
13
13
|
<%= "%-#{max_command_length}s %s" % [command.name, command.summary || command.description] %>
|
14
14
|
<% end -%>
|
15
|
-
<% end -%>
|
15
|
+
<% end -%>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Commander
|
4
|
+
module Patches
|
5
|
+
module PrioritySort
|
6
|
+
attr_accessor :priority
|
7
|
+
|
8
|
+
def <=>(other)
|
9
|
+
# Different classes can not be compared and thus are considered
|
10
|
+
# equal in priority
|
11
|
+
return 0 unless self.class == other.class
|
12
|
+
|
13
|
+
# Sort firstly based on the commands priority
|
14
|
+
comp = (self.priority || 0) <=> (other.priority || 0)
|
15
|
+
|
16
|
+
# Fall back on name comparison if priority is equal
|
17
|
+
comp == 0 ? self.name <=> other.name : comp
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/commander/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commander-openflighthpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alces Flight Ltd
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-09-
|
13
|
+
date: 2019-09-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: highline
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- lib/commander/patches/help_formatter_binding.rb
|
144
144
|
- lib/commander/patches/implicit-short-tags.rb
|
145
145
|
- lib/commander/patches/option_defaults.rb
|
146
|
+
- lib/commander/patches/priority_sort.rb
|
146
147
|
- lib/commander/patches/validate_inputs.rb
|
147
148
|
- lib/commander/platform.rb
|
148
149
|
- lib/commander/runner.rb
|