toys-core 0.3.4 → 0.3.5
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 -0
- data/CHANGELOG.md +7 -0
- data/README.md +8 -7
- data/docs/getting-started.md +8 -0
- data/lib/toys/cli.rb +2 -1
- data/lib/toys/config_dsl.rb +282 -74
- data/lib/toys/core_version.rb +1 -1
- data/lib/toys/helpers/exec.rb +47 -365
- data/lib/toys/loader.rb +1 -1
- data/lib/toys/middleware/add_verbosity_flags.rb +2 -2
- data/lib/toys/middleware/set_default_descriptions.rb +16 -16
- data/lib/toys/middleware/show_help.rb +35 -11
- data/lib/toys/middleware/show_version.rb +1 -1
- data/lib/toys/template.rb +1 -1
- data/lib/toys/templates/clean.rb +1 -1
- data/lib/toys/templates/gem_build.rb +1 -1
- data/lib/toys/templates/minitest.rb +1 -1
- data/lib/toys/templates/rubocop.rb +1 -1
- data/lib/toys/templates/yardoc.rb +1 -1
- data/lib/toys/tool.rb +110 -235
- data/lib/toys/utils/exec.rb +505 -0
- data/lib/toys/utils/help_text.rb +11 -11
- metadata +7 -4
data/lib/toys/utils/help_text.rb
CHANGED
@@ -81,7 +81,7 @@ module Toys
|
|
81
81
|
##
|
82
82
|
# Generate a short usage string.
|
83
83
|
#
|
84
|
-
# @param [Boolean] recursive If true, and the tool is a
|
84
|
+
# @param [Boolean] recursive If true, and the tool is a namespace,
|
85
85
|
# display all subcommands recursively. Defaults to false.
|
86
86
|
# @param [Integer] left_column_width Width of the first column. Default
|
87
87
|
# is {DEFAULT_LEFT_COLUMN_WIDTH}.
|
@@ -103,7 +103,7 @@ module Toys
|
|
103
103
|
##
|
104
104
|
# Generate a long help string.
|
105
105
|
#
|
106
|
-
# @param [Boolean] recursive If true, and the tool is a
|
106
|
+
# @param [Boolean] recursive If true, and the tool is a namespace,
|
107
107
|
# display all subcommands recursively. Defaults to false.
|
108
108
|
# @param [String,nil] search An optional string to search for when
|
109
109
|
# listing subcommands. Defaults to `nil` which finds all subcommands.
|
@@ -159,16 +159,16 @@ module Toys
|
|
159
159
|
def assemble
|
160
160
|
add_synopsis_section
|
161
161
|
add_flags_section
|
162
|
-
add_positional_arguments_section if @tool.
|
162
|
+
add_positional_arguments_section if @tool.includes_script?
|
163
163
|
add_subtool_list_section
|
164
164
|
@result = @lines.join("\n") + "\n"
|
165
165
|
end
|
166
166
|
|
167
167
|
def add_synopsis_section
|
168
168
|
synopses = []
|
169
|
-
synopses <<
|
169
|
+
synopses << namespace_synopsis if !@subtools.empty? && !@tool.includes_script?
|
170
170
|
synopses << tool_synopsis
|
171
|
-
synopses <<
|
171
|
+
synopses << namespace_synopsis if !@subtools.empty? && @tool.includes_script?
|
172
172
|
first = true
|
173
173
|
synopses.each do |synopsis|
|
174
174
|
@lines << (first ? "Usage: #{synopsis}" : " #{synopsis}")
|
@@ -185,7 +185,7 @@ module Toys
|
|
185
185
|
synopsis.join(" ")
|
186
186
|
end
|
187
187
|
|
188
|
-
def
|
188
|
+
def namespace_synopsis
|
189
189
|
([@binary_name] + @tool.full_name + ["TOOL", "[ARGUMENTS...]"]).join(" ")
|
190
190
|
end
|
191
191
|
|
@@ -321,12 +321,12 @@ module Toys
|
|
321
321
|
def add_synopsis_section
|
322
322
|
@lines << ""
|
323
323
|
@lines << bold("SYNOPSIS")
|
324
|
-
if !@subtools.empty? && !@tool.
|
325
|
-
add_synopsis_clause(
|
324
|
+
if !@subtools.empty? && !@tool.includes_script?
|
325
|
+
add_synopsis_clause(namespace_synopsis)
|
326
326
|
end
|
327
327
|
add_synopsis_clause(tool_synopsis)
|
328
|
-
if !@subtools.empty? && @tool.
|
329
|
-
add_synopsis_clause(
|
328
|
+
if !@subtools.empty? && @tool.includes_script?
|
329
|
+
add_synopsis_clause(namespace_synopsis)
|
330
330
|
end
|
331
331
|
end
|
332
332
|
|
@@ -349,7 +349,7 @@ module Toys
|
|
349
349
|
wrap_indent_indent2(Utils::WrappableString.new(synopsis))
|
350
350
|
end
|
351
351
|
|
352
|
-
def
|
352
|
+
def namespace_synopsis
|
353
353
|
synopsis = [full_binary_name, underline("TOOL"), "[#{underline('ARGUMENTS')}...]"]
|
354
354
|
wrap_indent_indent2(Utils::WrappableString.new(synopsis))
|
355
355
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toys-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -94,7 +94,8 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.9'
|
97
|
-
description:
|
97
|
+
description: Toys-Core is the command line tool framework underlying Toys. It can
|
98
|
+
be used to create command line binaries using the internal Toys APIs.
|
98
99
|
email:
|
99
100
|
- dazuma@gmail.com
|
100
101
|
executables: []
|
@@ -105,6 +106,7 @@ files:
|
|
105
106
|
- CHANGELOG.md
|
106
107
|
- LICENSE.md
|
107
108
|
- README.md
|
109
|
+
- docs/getting-started.md
|
108
110
|
- lib/toys-core.rb
|
109
111
|
- lib/toys/alias.rb
|
110
112
|
- lib/toys/cli.rb
|
@@ -133,6 +135,7 @@ files:
|
|
133
135
|
- lib/toys/templates/rubocop.rb
|
134
136
|
- lib/toys/templates/yardoc.rb
|
135
137
|
- lib/toys/tool.rb
|
138
|
+
- lib/toys/utils/exec.rb
|
136
139
|
- lib/toys/utils/help_text.rb
|
137
140
|
- lib/toys/utils/line_output.rb
|
138
141
|
- lib/toys/utils/module_lookup.rb
|
@@ -160,5 +163,5 @@ rubyforge_project:
|
|
160
163
|
rubygems_version: 2.7.6
|
161
164
|
signing_key:
|
162
165
|
specification_version: 4
|
163
|
-
summary:
|
166
|
+
summary: Framework for creating command line binaries
|
164
167
|
test_files: []
|