argvise 0.0.9 → 0.0.10
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/.rubocop.yml +18 -5
- data/.yardopts +4 -0
- data/docs/Readme.md +6 -0
- data/lib/argvise/core.rb +51 -36
- data/lib/argvise/refinement.rb +10 -6
- data/lib/argvise/version.rb +1 -1
- metadata +3 -7
- data/bin/build.rb +0 -19
- data/bin/console.rb +0 -67
- data/bin/irb.rb +0 -10
- data/rbi/lib/argvise.rbi +0 -40
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2d90fe07a2a4f58f550d26612903b467d83b99b1a0e0ae4ed00577e8e7459987
|
|
4
|
+
data.tar.gz: 444080af117dee382d702e6d3148d94733a90d94286187a55adda3744e37fb21
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ea1a7f17329319d8c172c092de516ebbaaf1440d4fafe4a12c3265f20e62e1169c34cc034c011bb84b1cb9feec1434c0eaccad3597d9361fc8b739e381b36d11
|
|
7
|
+
data.tar.gz: f7195c500e27b7cd429a6d23cbc95c76b1c32c468a22784503c491405cd5079190719ae4df76db9069d3dc54d091385c375bc0ae7984d6cf1f3e663e113d106d
|
data/.rubocop.yml
CHANGED
|
@@ -12,21 +12,34 @@ Lint/EmptyExpression:
|
|
|
12
12
|
|
|
13
13
|
# https://docs.rubocop.org/rubocop/cops_style.html
|
|
14
14
|
Style/TrailingCommaInHashLiteral:
|
|
15
|
-
|
|
15
|
+
EnforcedStyleForMultiline: diff_comma
|
|
16
16
|
Style/TrailingCommaInArrayLiteral:
|
|
17
|
-
|
|
17
|
+
EnforcedStyleForMultiline: diff_comma
|
|
18
18
|
Style/Lambda:
|
|
19
19
|
EnforcedStyle: literal
|
|
20
20
|
Style/ModuleFunction:
|
|
21
|
-
EnforcedStyle: extend_self
|
|
21
|
+
# EnforcedStyle: extend_self
|
|
22
|
+
EnforcedStyle: module_function
|
|
22
23
|
Style/BlockDelimiters:
|
|
23
|
-
|
|
24
|
+
EnforcedStyle: braces_for_chaining
|
|
24
25
|
Style/Documentation:
|
|
25
26
|
Enabled: false
|
|
27
|
+
Style/ClassAndModuleChildren:
|
|
28
|
+
EnforcedStyle: compact
|
|
29
|
+
|
|
30
|
+
# https://docs.rubocop.org/rubocop/cops_metrics.html
|
|
31
|
+
Metrics/MethodLength:
|
|
32
|
+
Max: 15
|
|
26
33
|
|
|
27
34
|
# https://docs.rubocop.org/rubocop/cops_layout.html
|
|
28
35
|
Layout/CaseIndentation:
|
|
29
36
|
EnforcedStyle: end
|
|
30
37
|
IndentOneStep: true
|
|
31
38
|
Layout/MultilineMethodCallIndentation:
|
|
32
|
-
EnforcedStyle:
|
|
39
|
+
EnforcedStyle: indented
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Naming/AsciiIdentifiers:
|
|
43
|
+
# AsciiConstants: false
|
|
44
|
+
Enabled: false
|
|
45
|
+
|
data/.yardopts
ADDED
data/docs/Readme.md
CHANGED
|
@@ -8,6 +8,12 @@ A Ruby gem for converting hash structures into command-line argument arrays.
|
|
|
8
8
|
|
|
9
9
|
> **Note:** This is *not* a command-line parser — quite the opposite. Argvise helps you **build** CLI commands programmatically.
|
|
10
10
|
|
|
11
|
+
## API DOC
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
- Github Pages: <https://2moe.github.io/argvise-gem>
|
|
16
|
+
|
|
11
17
|
## Quick Start
|
|
12
18
|
|
|
13
19
|
```ruby
|
data/lib/argvise/core.rb
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# ------------------
|
|
6
6
|
# Converts hash to command array
|
|
7
7
|
#
|
|
8
|
-
#
|
|
8
|
+
# @example
|
|
9
9
|
#
|
|
10
10
|
# { cargo: nil, b: nil, r: true, target: "wasm32-wasip2" }
|
|
11
11
|
# .then(&Argvise.new_proc)
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
#
|
|
16
16
|
# #=> ["cargo", "b", "-r", "--target", "wasm32-wasip2"]
|
|
17
17
|
#
|
|
18
|
-
#
|
|
18
|
+
# # Conversion Rules:
|
|
19
19
|
#
|
|
20
|
-
#
|
|
20
|
+
# ## GNU Style:
|
|
21
21
|
# - Boolean values:
|
|
22
22
|
# - `{ verbose: true }` => ["--verbose"]
|
|
23
23
|
# - `{ v: true }` => ["-v"]
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
# - `{ L: { env: 'test' } }` => `["-L", "env=test"]`
|
|
33
33
|
# - `{ label: { env: 'test' } }` => `["--label", "env=test"]`
|
|
34
34
|
#
|
|
35
|
-
#
|
|
35
|
+
# ## BSD Style:
|
|
36
36
|
# - Boolean values:
|
|
37
37
|
# - `{ verbose: true }` => ["-verbose"]
|
|
38
38
|
# - `{ v: true }` => ["-v"]
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
# - `{ L: { env: 'test' } }` => `["-L", "env=test"]`
|
|
48
48
|
# - `{ label: { env: 'test' } }` => `["-label", "env=test"]`
|
|
49
49
|
#
|
|
50
|
-
#
|
|
50
|
+
# ## Common:
|
|
51
51
|
# - Raw values:
|
|
52
52
|
# - `{ cargo: nil, b: nil}` => `["cargo", "b"]`
|
|
53
53
|
# - `{ "-fv": nil}` => `["-fv"]`
|
|
54
54
|
#
|
|
55
|
-
#
|
|
55
|
+
# ## About kebab_case_flags:
|
|
56
56
|
# - `with_kebab_case_flags(true)`:
|
|
57
57
|
# - `{enable_jit: true}` =>
|
|
58
58
|
# - GNU-style: `["--enable-jit"]`
|
|
@@ -70,18 +70,17 @@ class Argvise
|
|
|
70
70
|
class << self
|
|
71
71
|
# Converts a hash into a command-line argument array
|
|
72
72
|
#
|
|
73
|
-
#
|
|
73
|
+
# @example
|
|
74
74
|
# require 'argvise'
|
|
75
75
|
# cmd = { ruby: nil, r: "argvise", verbose: true, e: true, "puts Argvise::VERSION": nil }
|
|
76
76
|
# opts = { bsd_style: false }
|
|
77
77
|
# Argvise.build(cmd, opts:)
|
|
78
78
|
#
|
|
79
|
-
#
|
|
80
|
-
#
|
|
81
|
-
#
|
|
79
|
+
# @param raw_cmd_hash [Hash] The hash to be converted (i.e., raw input data)
|
|
80
|
+
# @param opts [Hash]
|
|
81
|
+
# @see #initialize
|
|
82
82
|
#
|
|
83
|
-
#
|
|
84
|
-
# [Array<String>] The generated array of command-line arguments
|
|
83
|
+
# @return [Array<String>] The generated array of command-line arguments
|
|
85
84
|
def build(
|
|
86
85
|
raw_cmd_hash,
|
|
87
86
|
opts: nil
|
|
@@ -94,15 +93,16 @@ class Argvise
|
|
|
94
93
|
#
|
|
95
94
|
# Useful for transforming a hash of CLI arguments into a command array.
|
|
96
95
|
#
|
|
97
|
-
#
|
|
96
|
+
# @example
|
|
98
97
|
#
|
|
99
|
-
#
|
|
100
|
-
#
|
|
101
|
-
#
|
|
102
|
-
#
|
|
103
|
-
#
|
|
98
|
+
# require 'argvise'
|
|
99
|
+
# { ruby: nil, r: "argvise", e: true, "puts Argvise::VERSION": nil }
|
|
100
|
+
# .then(&Argvise.new_proc)
|
|
101
|
+
# .build
|
|
102
|
+
# .then{system *_1}
|
|
104
103
|
#
|
|
105
|
-
#
|
|
104
|
+
# @see #initialize
|
|
105
|
+
# @return [::Proc] `.call(raw_cmd_hash)` => self
|
|
106
106
|
def new_proc
|
|
107
107
|
->(raw_cmd_hash) do
|
|
108
108
|
new(raw_cmd_hash)
|
|
@@ -111,15 +111,16 @@ class Argvise
|
|
|
111
111
|
# ----
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
-
#
|
|
114
|
+
# @example
|
|
115
115
|
#
|
|
116
116
|
# require 'argvise'
|
|
117
117
|
# cmd = { ruby: nil, r: "argvise", verbose: true, e: true, "puts Argvise::VERSION": nil }
|
|
118
118
|
# opts = Argvise::DEFAULT_OPTS
|
|
119
119
|
# Argvise.new(cmd, opts:).build.then{system *_1}
|
|
120
120
|
#
|
|
121
|
-
#
|
|
122
|
-
#
|
|
121
|
+
# @param opts [Hash]: { bsd_style: Boolean, kebab_case_flags: Boolean }
|
|
122
|
+
#
|
|
123
|
+
# ## opts
|
|
123
124
|
#
|
|
124
125
|
# - When `bsd_style` is set to `false`, the builder operates in **GNU-style mode**,
|
|
125
126
|
# which typically uses hyphenated flags.
|
|
@@ -128,12 +129,11 @@ class Argvise
|
|
|
128
129
|
# will be automatically converted to hyphens (`-`).
|
|
129
130
|
# - For example, a flag like `--enable_jit` will be transformed into `--enable-jit`.
|
|
130
131
|
#
|
|
131
|
-
# When the value of a flag key is `nil`, the `kebab_case_flags` option has no effect
|
|
132
|
+
# When the value of a flag key is `nil`, the `kebab_case_flags` option has no effect.
|
|
132
133
|
# — i.e., the key will not be transformed.
|
|
133
134
|
#
|
|
134
135
|
# For example, the input `{"a_b-c": nil}` will result in `["a_b-c"]`,
|
|
135
136
|
# and **not** be automatically transformed into `["a-b-c"]`.
|
|
136
|
-
#
|
|
137
137
|
def initialize(
|
|
138
138
|
raw_cmd_hash,
|
|
139
139
|
opts: nil
|
|
@@ -145,16 +145,21 @@ class Argvise
|
|
|
145
145
|
@kebab_case_flags = opts[:kebab_case_flags]
|
|
146
146
|
end
|
|
147
147
|
|
|
148
|
+
# Default: true
|
|
149
|
+
# @return [self]
|
|
148
150
|
def with_bsd_style(value = true) # rubocop:disable Style/OptionalBooleanParameter
|
|
149
151
|
@bsd_style = value
|
|
150
152
|
self
|
|
151
153
|
end
|
|
152
154
|
|
|
155
|
+
# Default: true
|
|
156
|
+
# @return [self]
|
|
153
157
|
def with_kebab_case_flags(value = true) # rubocop:disable Style/OptionalBooleanParameter
|
|
154
158
|
@kebab_case_flags = value
|
|
155
159
|
self
|
|
156
160
|
end
|
|
157
161
|
|
|
162
|
+
# @return [Array<String>]
|
|
158
163
|
def build
|
|
159
164
|
# @raw_cmd_hash.each_pair.flat_map { |k, v| process_pair(k.to_s, v) }
|
|
160
165
|
@raw_cmd_hash.each_with_object([]) do |(k, v), memo|
|
|
@@ -185,13 +190,13 @@ class Argvise
|
|
|
185
190
|
# - short key, e.g., {verbose: true} => "-verbose"
|
|
186
191
|
# - no long key
|
|
187
192
|
#
|
|
188
|
-
#
|
|
193
|
+
# kebab_case_flags==true:
|
|
189
194
|
# - "_" => "-"
|
|
190
195
|
# - e.g., {enable_jit: true} =>
|
|
191
196
|
# - BSD-style: "-enable-jit"
|
|
192
197
|
# - GNU-style: "--enable-jit"
|
|
193
198
|
#
|
|
194
|
-
#
|
|
199
|
+
# kebab_case_flags==false:
|
|
195
200
|
# - e.g., {enable_jit: true} =>
|
|
196
201
|
# - BSD-style: "-enable_jit"
|
|
197
202
|
# - GNU-style: "--enable_jit"
|
|
@@ -254,10 +259,16 @@ class Argvise
|
|
|
254
259
|
end
|
|
255
260
|
|
|
256
261
|
class Argvise
|
|
257
|
-
|
|
262
|
+
# The foundation of {HashRefin} and {HashMixin}
|
|
263
|
+
module HashExt
|
|
258
264
|
# Converts a hash map into GNU-style command-line arguments.
|
|
259
265
|
#
|
|
260
|
-
#
|
|
266
|
+
# @param opts [Hash, nil] See also `Argvise.new`
|
|
267
|
+
#
|
|
268
|
+
# @see Argvise#initialize
|
|
269
|
+
# @see to_argv_bsd
|
|
270
|
+
#
|
|
271
|
+
# @example Basic usage
|
|
261
272
|
#
|
|
262
273
|
# require 'argvise'
|
|
263
274
|
# using Argvise::HashRefin
|
|
@@ -265,11 +276,8 @@ class Argvise
|
|
|
265
276
|
# { v: true, path: '/path/to/dir' }.to_argv
|
|
266
277
|
# #=> ["-v", "--path", "/path/to/dir"]
|
|
267
278
|
#
|
|
268
|
-
# == params:
|
|
269
|
-
#
|
|
270
|
-
# - opts: See also [Argvise::new]
|
|
271
279
|
#
|
|
272
|
-
#
|
|
280
|
+
# @example raw_cmd_hash.to_argv is equivalent to:
|
|
273
281
|
#
|
|
274
282
|
# raw_cmd_hash
|
|
275
283
|
# .then(&Argvise.new_proc)
|
|
@@ -277,15 +285,16 @@ class Argvise
|
|
|
277
285
|
# .with_kebab_case_flags(true)
|
|
278
286
|
# .build
|
|
279
287
|
#
|
|
280
|
-
#
|
|
281
|
-
# sig { params(opts: T.nilable(Hash)).returns(T::Array[String]) }
|
|
288
|
+
# @return [Array<String>]
|
|
282
289
|
def to_argv(opts = nil)
|
|
283
290
|
Argvise.build(self, opts:)
|
|
284
291
|
end
|
|
285
292
|
|
|
286
293
|
# Converts a hash map into BSD-style command-line arguments.
|
|
287
294
|
#
|
|
288
|
-
#
|
|
295
|
+
# @param opts [Hash]
|
|
296
|
+
# @see to_argv
|
|
297
|
+
# @example
|
|
289
298
|
#
|
|
290
299
|
# require 'argvise'
|
|
291
300
|
# using Argvise::HashRefin
|
|
@@ -293,6 +302,7 @@ class Argvise
|
|
|
293
302
|
# { path: '/path/to/dir' }.to_argv_bsd
|
|
294
303
|
# #=> ["-path", "/path/to/dir"]
|
|
295
304
|
#
|
|
305
|
+
# @return [Array<String>]
|
|
296
306
|
def to_argv_bsd(options = {})
|
|
297
307
|
# if options is not Hash Type => {}
|
|
298
308
|
options = {} unless options.is_a?(::Hash)
|
|
@@ -304,7 +314,12 @@ class Argvise
|
|
|
304
314
|
|
|
305
315
|
# Converts a hash map into command-line arguments.
|
|
306
316
|
#
|
|
307
|
-
#
|
|
317
|
+
# Monkey Patching:
|
|
318
|
+
#
|
|
319
|
+
# - Hash#to_argv
|
|
320
|
+
# - Hash#to_argv_bsd
|
|
321
|
+
#
|
|
322
|
+
# @example
|
|
308
323
|
#
|
|
309
324
|
# require 'argvise'
|
|
310
325
|
#
|
data/lib/argvise/refinement.rb
CHANGED
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
# To maintain `mruby` compatibility, define `private_constant` and
|
|
5
|
-
# `refinements` in
|
|
5
|
+
# `refinements` in **refinement.rb** rather than in **core.rb**.
|
|
6
6
|
|
|
7
|
-
class Argvise
|
|
8
|
-
|
|
7
|
+
class Argvise # rubocop:disable Style/ClassAndModuleChildren
|
|
8
|
+
# Probably no need to mark this as private.
|
|
9
|
+
# private_constant :HashExt
|
|
9
10
|
|
|
10
|
-
# Refinements:
|
|
11
|
+
# Refinements:
|
|
11
12
|
#
|
|
12
|
-
#
|
|
13
|
+
# - Hash#to_argv
|
|
14
|
+
# - Hash#to_argv_bsd
|
|
15
|
+
#
|
|
16
|
+
# @example
|
|
13
17
|
#
|
|
14
18
|
# require 'argvise'
|
|
15
19
|
# class A
|
|
@@ -21,7 +25,7 @@ class Argvise
|
|
|
21
25
|
# puts({ target: "wasm32-wasip2" }.to_argv_bsd)
|
|
22
26
|
# # => ["-target", "wasm32-wasip2"]
|
|
23
27
|
#
|
|
24
|
-
# {}.respond_to?(:to_argv) #=> true
|
|
28
|
+
# puts({}.respond_to?(:to_argv)) #=> true
|
|
25
29
|
# end
|
|
26
30
|
# end
|
|
27
31
|
#
|
data/lib/argvise/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: argvise
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- 2moe
|
|
@@ -11,28 +11,24 @@ date: 1980-01-02 00:00:00.000000000 Z
|
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: Provides flexible command-line argument generation with support for complex
|
|
13
13
|
data structures
|
|
14
|
-
email:
|
|
15
|
-
- m@tmoe.me
|
|
16
14
|
executables: []
|
|
17
15
|
extensions: []
|
|
18
16
|
extra_rdoc_files: []
|
|
19
17
|
files:
|
|
20
18
|
- ".rubocop.yml"
|
|
19
|
+
- ".yardopts"
|
|
21
20
|
- License
|
|
22
|
-
- bin/build.rb
|
|
23
|
-
- bin/console.rb
|
|
24
|
-
- bin/irb.rb
|
|
25
21
|
- docs/Readme.md
|
|
26
22
|
- lib/argvise.rb
|
|
27
23
|
- lib/argvise/core.rb
|
|
28
24
|
- lib/argvise/refinement.rb
|
|
29
25
|
- lib/argvise/version.rb
|
|
30
|
-
- rbi/lib/argvise.rbi
|
|
31
26
|
homepage: https://github.com/2moe/argvise-gem
|
|
32
27
|
licenses:
|
|
33
28
|
- Apache-2.0
|
|
34
29
|
metadata:
|
|
35
30
|
homepage_uri: https://github.com/2moe/argvise-gem
|
|
31
|
+
documentation_uri: https://2moe.github.io/argvise-gem/
|
|
36
32
|
rdoc_options: []
|
|
37
33
|
require_paths:
|
|
38
34
|
- lib
|
data/bin/build.rb
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# typed: ignore
|
|
3
|
-
# frozen_string_literal: true
|
|
4
|
-
|
|
5
|
-
require 'pathname'
|
|
6
|
-
|
|
7
|
-
Pathname(__dir__ || File.dirname(__FILE__))
|
|
8
|
-
.parent
|
|
9
|
-
.then { Dir.chdir(it) }
|
|
10
|
-
|
|
11
|
-
proj = 'argvise'
|
|
12
|
-
|
|
13
|
-
system <<~CMD
|
|
14
|
-
gem uninstall #{proj}
|
|
15
|
-
gem build #{proj}
|
|
16
|
-
gem install #{proj}
|
|
17
|
-
CMD
|
|
18
|
-
|
|
19
|
-
# gem push argvise-*.gem
|
data/bin/console.rb
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# typed: ignore
|
|
3
|
-
# frozen_string_literal: true
|
|
4
|
-
|
|
5
|
-
# lib_path = File.expand_path('../lib', __dir__)
|
|
6
|
-
# exec "irb -I #{lib_path} -r argvise"
|
|
7
|
-
|
|
8
|
-
# require "bundler/setup"
|
|
9
|
-
# require "argvise"
|
|
10
|
-
require 'irb'
|
|
11
|
-
require_relative '../lib/argvise'
|
|
12
|
-
|
|
13
|
-
puts "Argvise: #{Argvise::VERSION}"
|
|
14
|
-
|
|
15
|
-
def puts_division_line
|
|
16
|
-
puts
|
|
17
|
-
puts '-' * 80
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
raw_cmd = {
|
|
21
|
-
compiler: nil,
|
|
22
|
-
build: nil,
|
|
23
|
-
pack_type: 'tar+zstd',
|
|
24
|
-
push: true,
|
|
25
|
-
v: true,
|
|
26
|
-
f: 'p2',
|
|
27
|
-
tag: ['v0.0.1', 'beta'],
|
|
28
|
-
platform: 'wasi/wasm',
|
|
29
|
-
label: {
|
|
30
|
-
maintainer: 'user',
|
|
31
|
-
description: 'Demo'
|
|
32
|
-
},
|
|
33
|
-
"/path/to/dir": nil
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
puts 'GNU-style + kebab_case_flags(false)'
|
|
37
|
-
raw_cmd
|
|
38
|
-
.then(&Argvise.new_proc)
|
|
39
|
-
.with_bsd_style(false)
|
|
40
|
-
.with_kebab_case_flags(false)
|
|
41
|
-
.build
|
|
42
|
-
.display
|
|
43
|
-
|
|
44
|
-
puts_division_line
|
|
45
|
-
# -----------
|
|
46
|
-
|
|
47
|
-
using Argvise::HashRefin
|
|
48
|
-
puts 'GNU-style + kebab_case_flags(true)'
|
|
49
|
-
raw_cmd
|
|
50
|
-
.to_argv
|
|
51
|
-
.display
|
|
52
|
-
|
|
53
|
-
puts_division_line
|
|
54
|
-
# -----------
|
|
55
|
-
|
|
56
|
-
puts 'BSD-style + kebab_case_flags(true)'
|
|
57
|
-
raw_cmd
|
|
58
|
-
.then(&Argvise.new_proc)
|
|
59
|
-
.with_bsd_style
|
|
60
|
-
.with_kebab_case_flags
|
|
61
|
-
.build
|
|
62
|
-
.display
|
|
63
|
-
|
|
64
|
-
puts_division_line
|
|
65
|
-
# -----------
|
|
66
|
-
|
|
67
|
-
IRB.start
|
data/bin/irb.rb
DELETED
data/rbi/lib/argvise.rbi
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# rubocop:disable Style/Documentation, Lint/MissingCopEnableDirective
|
|
2
|
-
# typed: true
|
|
3
|
-
# frozen_string_literal: true
|
|
4
|
-
|
|
5
|
-
class Argvise
|
|
6
|
-
class << self
|
|
7
|
-
sig do
|
|
8
|
-
params(
|
|
9
|
-
raw_cmd_hash: T.any(Hash, HashExt),
|
|
10
|
-
opts: T.nilable(T::Hash[Symbol, T::Boolean])
|
|
11
|
-
).returns(T::Array[String])
|
|
12
|
-
end
|
|
13
|
-
def build(raw_cmd_hash, opts: nil); end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
sig do
|
|
17
|
-
params(
|
|
18
|
-
raw_cmd_hash: T.any(Hash, HashExt),
|
|
19
|
-
opts: T.nilable(T::Hash[Symbol, T::Boolean])
|
|
20
|
-
).void
|
|
21
|
-
end
|
|
22
|
-
def initialize(raw_cmd_hash, opts: nil); end
|
|
23
|
-
|
|
24
|
-
sig { params(value: T::Boolean).returns(T.self_type) }
|
|
25
|
-
def with_bsd_style(value = true); end # rubocop:disable Style/OptionalBooleanParameter
|
|
26
|
-
|
|
27
|
-
sig { params(value: T::Boolean).returns(T.self_type) }
|
|
28
|
-
def with_kebab_case_flags(value = true); end # rubocop:disable Style/OptionalBooleanParameter
|
|
29
|
-
|
|
30
|
-
sig { returns(T::Array[String]) }
|
|
31
|
-
def build; end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
class ::Hash
|
|
35
|
-
sig { params(opts: T.nilable(Hash)).returns(T::Array[String]) }
|
|
36
|
-
def to_argv(opts = nil); end
|
|
37
|
-
|
|
38
|
-
sig { params(options: Hash).returns(T::Array[String]) }
|
|
39
|
-
def to_argv_bsd(options = {}); end
|
|
40
|
-
end
|