command_mapper-gen 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/ChangeLog.md +6 -0
- data/Gemfile +1 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/lib/command_mapper/gen/cli.rb +2 -2
- data/lib/command_mapper/gen/command.rb +5 -0
- data/lib/command_mapper/gen/parsers/help.rb +5 -2
- data/lib/command_mapper/gen/parsers/options.rb +14 -4
- data/lib/command_mapper/gen/version.rb +1 -1
- data/spec/cli_spec.rb +2 -0
- data/spec/command_spec.rb +2 -0
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7db506d5c89f29a11905cde640c4ffcd3e785e87c480b38a771a747eca744909
|
4
|
+
data.tar.gz: 9845fd793e8056ed3975735db5728b6909b5ccfd9b64c4547bcbad1957e2d998
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afe9ffc7ae1e7e85a3de3219d3400c861a3b392f2441e0036c5c25ded432988c030965fa93f6be6d81debd7da2d0c1063da4307ac27a3951a61006a9538c375b
|
7
|
+
data.tar.gz: 9a234d24838b9486af96d2db48185fd88a2106dd0b412a947c11d08fe854dc9ea53824a01706f989fd2dc9d42373a6c3c0a3f715f0a50cb15f3231dd0943edbe
|
data/.yardopts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--markup markdown --title "CommandMapper::Gen Documentation" --protected
|
1
|
+
--markup markdown --title "CommandMapper::Gen Documentation" --protected
|
data/ChangeLog.md
CHANGED
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -198,7 +198,7 @@ module CommandMapper
|
|
198
198
|
#
|
199
199
|
def print_parser_error(command,string,error)
|
200
200
|
$stderr.puts "Failed to parse line in `#{command.command_string} --help`:"
|
201
|
-
$stderr.puts
|
201
|
+
$stderr.puts
|
202
202
|
$stderr.puts " #{string}"
|
203
203
|
$stderr.puts
|
204
204
|
|
@@ -210,7 +210,7 @@ module CommandMapper
|
|
210
210
|
$stderr.puts error.message
|
211
211
|
end
|
212
212
|
|
213
|
-
$stderr.puts
|
213
|
+
$stderr.puts
|
214
214
|
end
|
215
215
|
|
216
216
|
#
|
@@ -117,6 +117,9 @@ module CommandMapper
|
|
117
117
|
@command_name.split(/[_-]+/).map(&:capitalize).join
|
118
118
|
end
|
119
119
|
|
120
|
+
# URL to the documentation for `CommandMapper::Command`.
|
121
|
+
COMMAND_DOC_URL = "https://rubydoc.info/gems/command_mapper/CommandMapper/Command"
|
122
|
+
|
120
123
|
#
|
121
124
|
# Converts the parsed command to Ruby source code.
|
122
125
|
#
|
@@ -132,6 +135,8 @@ module CommandMapper
|
|
132
135
|
lines << "#"
|
133
136
|
lines << "# Represents the `#{@command_name}` command"
|
134
137
|
lines << "#"
|
138
|
+
lines << "# @see #{COMMAND_DOC_URL}"
|
139
|
+
lines << "#"
|
135
140
|
|
136
141
|
lines << "class #{class_name} < CommandMapper::Command"
|
137
142
|
lines << ""
|
@@ -108,9 +108,12 @@ module CommandMapper
|
|
108
108
|
#
|
109
109
|
# Parses an individual argument node.
|
110
110
|
#
|
111
|
-
# @param [Hash]
|
111
|
+
# @param [Hash] argument
|
112
112
|
# An argument node.
|
113
113
|
#
|
114
|
+
# @param [Hash{Symbol => Object}] kwargs
|
115
|
+
# Additional keyword arguments for {Command#argument}.
|
116
|
+
#
|
114
117
|
def parse_argument(argument,**kwargs)
|
115
118
|
name = argument[:name].to_s.downcase
|
116
119
|
keywords = kwargs
|
@@ -141,7 +144,7 @@ module CommandMapper
|
|
141
144
|
keywords[:required] = false
|
142
145
|
|
143
146
|
parse_arguments(node[:optional], **keywords)
|
144
|
-
|
147
|
+
elsif node[:argument]
|
145
148
|
parse_argument(node[:argument], **keywords)
|
146
149
|
end
|
147
150
|
end
|
@@ -58,13 +58,23 @@ module CommandMapper
|
|
58
58
|
|
59
59
|
rule(:square_brackets) do
|
60
60
|
(
|
61
|
-
str('[') >> space? >>
|
62
|
-
value >>
|
63
|
-
space? >> str(']')
|
61
|
+
str('[') >> space? >> value >> space? >> str(']')
|
64
62
|
).as(:optional)
|
65
63
|
end
|
66
64
|
|
65
|
+
rule(:single_quotes) do
|
66
|
+
str("'") >> name >> str("'")
|
67
|
+
end
|
68
|
+
|
69
|
+
rule(:double_quotes) do
|
70
|
+
str('"') >> name >> str('"')
|
71
|
+
end
|
72
|
+
|
67
73
|
rule(:value_container) do
|
74
|
+
# "'...'"
|
75
|
+
single_quotes |
|
76
|
+
# "\"...\""
|
77
|
+
double_quotes |
|
68
78
|
# "{...}"
|
69
79
|
curly_braces |
|
70
80
|
# "<...>"
|
@@ -115,7 +125,7 @@ module CommandMapper
|
|
115
125
|
rule(:option_summary) { any.repeat(1) }
|
116
126
|
|
117
127
|
rule(:option_line) do
|
118
|
-
(str("\t") | spaces) >> option >>
|
128
|
+
(str("\t") | spaces) >> option >> match[',:'].maybe >>
|
119
129
|
(match[' \t'].repeat(1) >> option_summary).maybe >> any.absent?
|
120
130
|
end
|
121
131
|
|
data/spec/cli_spec.rb
CHANGED
@@ -58,6 +58,8 @@ describe CommandMapper::Gen::CLI do
|
|
58
58
|
"#",
|
59
59
|
"# Represents the `#{command_name}` command",
|
60
60
|
"#",
|
61
|
+
"# @see #{CommandMapper::Gen::Command::COMMAND_DOC_URL}",
|
62
|
+
"#",
|
61
63
|
"class #{command_name.capitalize} < CommandMapper::Command",
|
62
64
|
"",
|
63
65
|
" command \"#{command_name}\" do",
|
data/spec/command_spec.rb
CHANGED
@@ -146,6 +146,8 @@ describe CommandMapper::Gen::Command do
|
|
146
146
|
"#",
|
147
147
|
"# Represents the `#{subject.command_name}` command",
|
148
148
|
"#",
|
149
|
+
"# @see #{described_class::COMMAND_DOC_URL}",
|
150
|
+
"#",
|
149
151
|
"class #{subject.class_name} < CommandMapper::Command",
|
150
152
|
"",
|
151
153
|
" command #{subject.command_name.inspect} do",
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: command_mapper-gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Postmodern
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-06-25 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: parslet
|
@@ -111,7 +110,6 @@ metadata:
|
|
111
110
|
bug_tracker_uri: https://github.com/postmodern/command_mapper-gen.rb/issues
|
112
111
|
changelog_uri: https://github.com/postmodern/command_mapper-gen.rb/blob/master/ChangeLog.md
|
113
112
|
rubygems_mfa_required: 'true'
|
114
|
-
post_install_message:
|
115
113
|
rdoc_options: []
|
116
114
|
require_paths:
|
117
115
|
- lib
|
@@ -126,8 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
124
|
- !ruby/object:Gem::Version
|
127
125
|
version: '0'
|
128
126
|
requirements: []
|
129
|
-
rubygems_version: 3.2
|
130
|
-
signing_key:
|
127
|
+
rubygems_version: 3.6.2
|
131
128
|
specification_version: 4
|
132
129
|
summary: Generates command_mapper Ruby classes for a given command
|
133
130
|
test_files: []
|