argvise 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e02579f4619b47f97e46fe3052e577680cd88ba737f742fe581fc55ef7a54527
4
- data.tar.gz: '08e79eab0d15b6ec23367d39d23e60dbbc0c969b32e632d6aabb54727136d0c1'
3
+ metadata.gz: baf5e36d57cbce4d441556b353f25a40cccb258762496b029ea31931c5f0a9ce
4
+ data.tar.gz: 6727e52bba5ce34e77e5649700c9c404fce0a66d7f7223f5a8f8e9e6abbfd21d
5
5
  SHA512:
6
- metadata.gz: 87b6122a07799b34702cdc391d8e9c5219ae93c1380f948d0c7359ec71c94e1256274ee03dfd24becd2b0c91f1f2c6992d3a4c8418333dd0a72d8545099a2cc9
7
- data.tar.gz: de14f0f04cace2b164919228c0126692682acfaab406cb710b27828f1db1731f9a59281609cd5c09aab4344e78aa9a11f4f55e2148c0022e404bbd636bf36ccc
6
+ metadata.gz: 97ad4a558c1b08ec2b64607e92761bb9ea1592cbfbb3d96fa9307179ae77e1123d6a2ef28725b36d77a2bd15d11dcf4a00cafe11868fab20adf3d73a926a9b3b
7
+ data.tar.gz: 3de59adb8b956fdb71342fb84064ba9a5a0fcc6030bf5e83a17ba2512223cc4185685057c9e2bd18efa0fefd0e4485d165282fc33efca534b9f8059ceff95417
data/docs/Readme.md CHANGED
@@ -20,7 +20,7 @@ system "gem install argvise"
20
20
  require 'argvise'
21
21
 
22
22
  raw_cmd_hash = {
23
- cargo: nil, b: nil, r: true, target: "wasm32-wasip2"
23
+ cargo: (), b: (), r: true, target: "wasm32-wasip2"
24
24
  }
25
25
 
26
26
  raw_cmd_hash
@@ -81,6 +81,7 @@ gem install argvise
81
81
  | `{ "-k2": nil }` | `["-k2"]` |
82
82
  | `{ "--r_a-w_": nil }` | `["--r_a-w_"]` |
83
83
  | `{ key: nil }` | `["key"]` |
84
+ | `{ key: () }` | `["key"]` |
84
85
  | `{ key: [] }` | `[]` |
85
86
  | `{ key: {} }` | `[]` |
86
87
  | `{ key: false }` | `[]` |
@@ -89,7 +90,6 @@ gem install argvise
89
90
  | `{ k: ["a", "b"] }` | `["-k", "a", "-k", "b"]` |
90
91
  | `{ k: { a: 1, b: 2 } }` | `["-k", "a=1", "-k", "b=2"]` |
91
92
 
92
-
93
93
  ### GNU Style
94
94
 
95
95
  | Hash Format | Result |
@@ -101,7 +101,7 @@ gem install argvise
101
101
 
102
102
  ---
103
103
 
104
- #### `with_kebab_case_flags(true)`:
104
+ #### `with_kebab_case_flags(true)`
105
105
 
106
106
  | Hash Format | Result |
107
107
  | ----------------- | ------------- |
@@ -109,13 +109,12 @@ gem install argvise
109
109
 
110
110
  ---
111
111
 
112
- #### `with_kebab_case_flags(false)`:
112
+ #### `with_kebab_case_flags(false)`
113
113
 
114
114
  | Hash Format | Result |
115
115
  | ----------------- | ------------- |
116
116
  | `{ key_b: true }` | `["--key_b"]` |
117
117
 
118
-
119
118
  ### BSD Style
120
119
 
121
120
  | Hash Format | Result |
@@ -127,7 +126,9 @@ gem install argvise
127
126
 
128
127
  ---
129
128
 
130
- #### `with_kebab_case_flags(true)`:
129
+ <!-- markdownlint-disable MD024 no-duplicate-heading -->
130
+
131
+ #### `with_kebab_case_flags(true)`
131
132
 
132
133
  | Hash Format | Result |
133
134
  | ----------------- | ------------ |
@@ -135,13 +136,12 @@ gem install argvise
135
136
 
136
137
  ---
137
138
 
138
- #### `with_kebab_case_flags(false)`:
139
+ #### `with_kebab_case_flags(false)`
139
140
 
140
141
  | Hash Format | Result |
141
142
  | ----------------- | ------------ |
142
143
  | `{ key_d: true }` | `["-key_d"]` |
143
144
 
144
-
145
145
  ### Notes
146
146
 
147
147
  > When the value of a flag key is `nil`, the `kebab_case_flags` option has
@@ -191,13 +191,14 @@ Argvise.build(raw_cmd_hash)
191
191
  ### Configurable builder
192
192
 
193
193
  > Required
194
- > - argvise: >= v0.0.4
195
- > - ruby: >= v3.1.0
194
+ >
195
+ > - argvise: >= v0.0.6
196
+ > - ruby: >= v3.1.0
196
197
 
197
198
  ```ruby
198
199
  raw_cmd = {
199
- compiler: nil,
200
- build: nil,
200
+ compiler: (),
201
+ build: (),
201
202
  pack_type: 'tar+zstd',
202
203
  push: true,
203
204
  v: true,
@@ -208,7 +209,7 @@ raw_cmd = {
208
209
  maintainer: 'user',
209
210
  description: 'Demo'
210
211
  },
211
- "/path/to/dir": nil
212
+ "/path/to/dir": ()
212
213
  }
213
214
 
214
215
  p '----------------'
@@ -248,15 +249,15 @@ raw_cmd
248
249
 
249
250
  #### GNU style
250
251
 
251
- - `{ verbose: true }` => "--verbose"
252
- - `{ v: true }` => "-v"
253
- - `{ v: false }` => no argument generated
252
+ - `{ verbose: true }` => `["--verbose"]`
253
+ - `{ v: true }` => `["-v"]`
254
+ - `{ v: false }` => `[]`
254
255
 
255
256
  #### BSD style
256
257
 
257
- - `{ verbose: true }` => "-verbose"
258
- - `{ v: true }` => "-v"
259
- - `{ v: false }` => no argument generated
258
+ - `{ verbose: true }` => `["-verbose"]`
259
+ - `{ v: true }` => `["-v"]`
260
+ - `{ v: false }` => `[]`
260
261
 
261
262
  ### String
262
263
 
@@ -296,9 +297,9 @@ raw_cmd
296
297
 
297
298
  ## Nil => Raw
298
299
 
299
- - `{ cargo: nil, b: nil}` => `["cargo", "b"]`
300
- - `{ "-fv": nil}` => `["-fv"]`
301
-
300
+ - `{ cargo: () }` => `["cargo"]`
301
+ - `{ cargo: nil, b: nil }` => `["cargo", "b"]`
302
+ - `{ "-fv": nil }` => `["-fv"]`
302
303
 
303
304
  ## Changelog
304
305
 
@@ -306,7 +307,7 @@ raw_cmd
306
307
 
307
308
  Breaking Changes:
308
309
 
309
- - `.hash_to_argv` => `Hash.to_argv(opts)`
310
+ - `cmd_hash |> hash_to_argv` => `cmd_hash.to_argv(opts)`
310
311
  - i.e.,
311
312
  - old: `{a: true}.then(&hash_to_argv)`
312
313
  - new: `{a: true}.to_argv`
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  class Argvise
5
- VERSION = '0.0.6'
5
+ VERSION = '0.0.7'
6
6
  end
data/lib/core.rb CHANGED
@@ -19,9 +19,9 @@
19
19
  #
20
20
  # === GNU Style:
21
21
  # - Boolean values:
22
- # - `{ verbose: true }` => "--verbose"
23
- # - `{ v: true }` => "-v"
24
- # - `{ v: false }` => no argument generated
22
+ # - `{ verbose: true }` => ["--verbose"]
23
+ # - `{ v: true }` => ["-v"]
24
+ # - `{ v: false }` => [] #no argument generated
25
25
  # - String values:
26
26
  # - `{ f: "a.txt" }` => ["-f", "a.txt"]
27
27
  # - `{ file: "a.txt" }` => ["--file", "a.txt"]
@@ -34,9 +34,9 @@
34
34
  #
35
35
  # === BSD Style:
36
36
  # - Boolean values:
37
- # - `{ verbose: true }` => "-verbose"
38
- # - `{ v: true }` => "-v"
39
- # - `{ v: false }` => no argument generated
37
+ # - `{ verbose: true }` => ["-verbose"]
38
+ # - `{ v: true }` => ["-v"]
39
+ # - `{ v: false }` => [] #no argument generated
40
40
  # - String values:
41
41
  # - `{ f: "a.txt" }` => ["-f", "a.txt"]
42
42
  # - `{ file: "a.txt" }` => ["-file", "a.txt"]
@@ -254,7 +254,7 @@ class Argvise
254
254
  end
255
255
 
256
256
  class ::Hash # rubocop:disable Style/Documentation
257
- # A convenient lambda method: converts a hash into command-line arguments
257
+ # Converts a hash into command-line arguments
258
258
  #
259
259
  # == Example:
260
260
  #
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - 2moe