benry-cmdapp 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +7 -0
- data/README.md +1 -1
- data/benry-cmdapp.gemspec +1 -1
- data/doc/benry-cmdapp.html +1 -1
- data/lib/benry/cmdapp.rb +9 -6
- data/test/help_test.rb +29 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55cda8dcd81c8ebb9de51a568d94408fc177d6f9425e25bba54b2b3cf6836762
|
4
|
+
data.tar.gz: c5d12034ccedd2fe0c18916a566588f21e58267d7e0d20d42c807d5f3134fbc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4991a36655d4ab69e709a83e8e5965c00c704d91fb9323a79db33c29d47fb08f2787add47270d42e12180cc8dbdd0a80bfe840c6624105e63fe209e09ca0f1c
|
7
|
+
data.tar.gz: d9b9a8b181fbcf9741aa4685b23a0efcf3ddf507c2363a63a8eab1d96b35f8f60e64a980834c47b37eedef71a404b28e00d4e93aa956a10b09b3f5b5e809e2ba
|
data/CHANGES.md
CHANGED
@@ -2,6 +2,13 @@ CHANGES
|
|
2
2
|
=======
|
3
3
|
|
4
4
|
|
5
|
+
Release 1.1.2 (2024-09-30)
|
6
|
+
--------------------------
|
7
|
+
|
8
|
+
* [change] Change to report error when prefix not matched any task names.
|
9
|
+
* [bugfix] Fix a minor bug related to listing candidates.
|
10
|
+
|
11
|
+
|
5
12
|
Release 1.1.1 (2023-12-29)
|
6
13
|
--------------------------
|
7
14
|
|
data/README.md
CHANGED
data/benry-cmdapp.gemspec
CHANGED
data/doc/benry-cmdapp.html
CHANGED
data/lib/benry/cmdapp.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
###
|
5
|
-
### $Release: 1.1.
|
5
|
+
### $Release: 1.1.2 $
|
6
6
|
### $Copyright: copyright(c) 2023 kwatch@gmail.com $
|
7
7
|
### $License: MIT License $
|
8
8
|
###
|
@@ -1491,12 +1491,12 @@ module Benry::CmdApp
|
|
1491
1491
|
#; [!nwwrd] if prefix is 'xxx:' and alias name is 'xxx' and action name of alias matches to 'xxx:', skip it because it will be shown in 'Aliases:' section.
|
1492
1492
|
_category_action?(metadata, prefix)
|
1493
1493
|
}
|
1494
|
-
|
1495
|
-
s1 = render_section(header(:HEADER_ACTIONS), str)
|
1494
|
+
s1 = str.empty? ? nil : render_section(header(:HEADER_ACTIONS), str)
|
1496
1495
|
#; [!otvbt] includes name of alias which corresponds to action starting with prefix.
|
1496
|
+
#; [!bgpsm] includes name of alias which is equal to prefix name excluding tailing ':'.
|
1497
1497
|
#; [!h5ek7] includes hidden aliases when `all: true` passed.
|
1498
1498
|
str = _render_metadata_list(c.format_action, all: all) {|metadata|
|
1499
|
-
metadata.alias? && metadata.action.start_with?(prefix)
|
1499
|
+
metadata.alias? && (metadata.action.start_with?(prefix) || metadata.action == prefix2)
|
1500
1500
|
}
|
1501
1501
|
#; [!9lnn2] alias names in candidate list are sorted by action name.
|
1502
1502
|
str = str.each_line.sort_by {|line|
|
@@ -1505,9 +1505,12 @@ module Benry::CmdApp
|
|
1505
1505
|
}.join()
|
1506
1506
|
#; [!80t51] alias names are displayed in separated section from actions.
|
1507
1507
|
s2 = str.empty? ? nil : render_section(header(:HEADER_ALIASES), str)
|
1508
|
-
#; [!
|
1508
|
+
#; [!jek9k] raises error when no actions nor aliases found starting with prefix.
|
1509
|
+
arr = [s1, s2].compact()
|
1510
|
+
! arr.empty? or
|
1511
|
+
raise CommandError, "'#{prefix}' : Unknown prefix. (Hint: try ':' instead of '#{prefix}' to list all prefixes.)"
|
1509
1512
|
#; [!3c3f1] returns list of actions which name starts with prefix specified.
|
1510
|
-
return
|
1513
|
+
return arr.join("\n")
|
1511
1514
|
end
|
1512
1515
|
|
1513
1516
|
def _category_action?(md, prefix)
|
data/test/help_test.rb
CHANGED
@@ -728,6 +728,30 @@ END
|
|
728
728
|
END
|
729
729
|
end
|
730
730
|
|
731
|
+
spec "[!bgpsm] includes name of alias which is equal to prefix name excluding tailing ':'." do
|
732
|
+
HelpTestAction.class_eval do
|
733
|
+
category "p5983:", action: "aaa" do
|
734
|
+
@action.("AAA")
|
735
|
+
def aaa()
|
736
|
+
end
|
737
|
+
@action.("BBB")
|
738
|
+
def bbb()
|
739
|
+
end
|
740
|
+
end
|
741
|
+
end
|
742
|
+
Benry::CmdApp.define_alias("p59", ["p5983", "-h"]) # !!!!
|
743
|
+
x = @builder.section_candidates("p5983:")
|
744
|
+
ok {x} == <<"END"
|
745
|
+
\e[1;34mActions:\e[0m
|
746
|
+
p5983 : AAA
|
747
|
+
\e[2m (alias: p59 (with '-h'))\e[0m
|
748
|
+
p5983:bbb : BBB
|
749
|
+
|
750
|
+
\e[1;34mAliases:\e[0m
|
751
|
+
p59 : alias for 'p5983 -h'
|
752
|
+
END
|
753
|
+
end
|
754
|
+
|
731
755
|
spec "[!h5ek7] includes hidden aliases when `all: true` passed." do
|
732
756
|
Benry::CmdApp.define_alias("add", "git:stage", hidden: true)
|
733
757
|
at_end { Benry::CmdApp.undef_alias("add") }
|
@@ -798,9 +822,11 @@ END
|
|
798
822
|
ok {x} =~ /^\e\[1;34mAliases:\e\[0m$/
|
799
823
|
end
|
800
824
|
|
801
|
-
spec "[!
|
802
|
-
|
803
|
-
ok {
|
825
|
+
spec "[!jek9k] raises error when no actions nor aliases found starting with prefix." do
|
826
|
+
pr = proc { @builder.section_candidates("blabla:") }
|
827
|
+
ok {pr}.raise?(Benry::CmdApp::CommandError,
|
828
|
+
"'blabla:' : Unknown prefix."\
|
829
|
+
" (Hint: try ':' instead of 'blabla:' to list all prefixes.)")
|
804
830
|
end
|
805
831
|
|
806
832
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benry-cmdapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kwatch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benry-cmdopt
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
|
-
rubygems_version: 3.4.
|
98
|
+
rubygems_version: 3.4.19
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Command-line application framework
|