qrlkit 0.12.1 → 0.14.0
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.
- package/README.md +76 -22
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -360,6 +360,46 @@ qrlkit greet Hey
|
|
|
360
360
|
|
|
361
361
|
Supported shells: `bash`, `sh`, and `zsh`.
|
|
362
362
|
|
|
363
|
+
### Arguments
|
|
364
|
+
|
|
365
|
+
Prompt for text or pick one allowed value.
|
|
366
|
+
|
|
367
|
+
```toml
|
|
368
|
+
[greet]
|
|
369
|
+
args = [
|
|
370
|
+
{ name = "name" },
|
|
371
|
+
{ name = "greeting", enum = ["Hello", "Hi", "Hey"] },
|
|
372
|
+
]
|
|
373
|
+
run = 'printf "%s, %s!\n" "$2" "$1"'
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
```sh
|
|
377
|
+
greet # Prompt for both
|
|
378
|
+
greet Ada # Choose a greeting
|
|
379
|
+
greet Ada Hi # Use both directly
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
Scripts use `"$1"`, `"$2"`, etc. in `args` order. URLs and paths use `{name}`.
|
|
383
|
+
Reuse a list with `enum = { ref = "shared.greetings" }`.
|
|
384
|
+
|
|
385
|
+
Select several values with `multiple = true` and a nonempty `join` separator.
|
|
386
|
+
|
|
387
|
+
```toml
|
|
388
|
+
[dashboard]
|
|
389
|
+
args = [
|
|
390
|
+
{ name = "regions", enum = ["eu", "us", "asia"], multiple = true, join = "," },
|
|
391
|
+
]
|
|
392
|
+
url = "https://dashboard.example.com/?regions={regions}"
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
```sh
|
|
396
|
+
dashboard # Space toggles, Enter confirms at least one
|
|
397
|
+
dashboard eu,asia # Supply the joined value directly
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
Interactive selections follow list order and become one value: `eu,asia`.
|
|
401
|
+
Values are URL-encoded in URLs. Choices must not conflict with the separator.
|
|
402
|
+
|
|
363
403
|
### Shared values
|
|
364
404
|
|
|
365
405
|
Put shared values in any config and register it with `qrlkit add`.
|
|
@@ -392,42 +432,56 @@ NAME = "{shared.name}"
|
|
|
392
432
|
|
|
393
433
|
### Composition
|
|
394
434
|
|
|
395
|
-
|
|
435
|
+
`qrlkit` offers a few ways to compose one QRL from multiple others. First principle is that everything is callable and referenceable if its not `hidden = true`.
|
|
396
436
|
|
|
397
|
-
|
|
398
|
-
# Reference another QRL's value or URL
|
|
399
|
-
url = "{project.home}/issues"
|
|
437
|
+
**One QRL calls another**
|
|
400
438
|
```
|
|
439
|
+
[qrl-1]
|
|
440
|
+
url = "https:/..."
|
|
401
441
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
[branch]
|
|
405
|
-
run = "git branch --show-current"
|
|
442
|
+
[qrl-1.qrl-2]
|
|
443
|
+
run = 'echo "sub/path"'
|
|
406
444
|
|
|
407
|
-
[
|
|
408
|
-
url = "{
|
|
445
|
+
[qrl-3]
|
|
446
|
+
url = "{qrl-1}/{qrl-1.qrl-2}"
|
|
409
447
|
```
|
|
448
|
+
Not here its possible to chain keys with a dot like `objs.fruits.apples`.
|
|
449
|
+
|
|
450
|
+
**Group static fields and ref them**
|
|
410
451
|
|
|
411
452
|
```toml
|
|
412
|
-
|
|
413
|
-
[
|
|
414
|
-
|
|
453
|
+
[args]
|
|
454
|
+
floors = ["1", "2", "3"]
|
|
455
|
+
apartment = ["a", "b", "c"]
|
|
415
456
|
|
|
416
|
-
[
|
|
417
|
-
url = "https://{
|
|
457
|
+
[ding]
|
|
458
|
+
url = "https://ding-a.door/{floor}/{apartment}"
|
|
459
|
+
args = [
|
|
460
|
+
{ name = "floor", enum = { ref = "args.floors" } },
|
|
461
|
+
{ name = "apartment", enum = { ref = "args.apartment" } },
|
|
462
|
+
]
|
|
418
463
|
```
|
|
419
464
|
|
|
465
|
+
**Dynamically look up keys**
|
|
466
|
+
|
|
420
467
|
```toml
|
|
421
|
-
|
|
422
|
-
[
|
|
423
|
-
|
|
424
|
-
|
|
468
|
+
[args]
|
|
469
|
+
project = ["docs", "status"]
|
|
470
|
+
environment = ["staging", "prod"]
|
|
471
|
+
|
|
472
|
+
[domains.docs]
|
|
473
|
+
staging = "docs-staging.example.com"
|
|
474
|
+
prod = "docs.example.com"
|
|
475
|
+
|
|
476
|
+
[domains.status]
|
|
477
|
+
staging = "status-staging.example.com"
|
|
478
|
+
prod = "status.example.com"
|
|
425
479
|
|
|
426
|
-
[
|
|
427
|
-
url = "https://{
|
|
480
|
+
[site]
|
|
481
|
+
url = "https://{domains[args.project, args.environment]}"
|
|
428
482
|
```
|
|
429
483
|
|
|
430
|
-
|
|
484
|
+
Here `domains[args.project, args.environment]` resolves by first prompting for project (`docs` or `status`) and then use that to select either `[domains.docs]` or `[domains.status]` and prompt for a environment (`staging` or `prod`).
|
|
431
485
|
|
|
432
486
|
### Hints and hidden groups
|
|
433
487
|
|
package/package.json
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"README.md"
|
|
10
10
|
],
|
|
11
11
|
"optionalDependencies": {
|
|
12
|
-
"qrlkit-darwin-arm64": "0.
|
|
13
|
-
"qrlkit-darwin-x64": "0.
|
|
14
|
-
"qrlkit-linux-arm64": "0.
|
|
15
|
-
"qrlkit-linux-x64": "0.
|
|
12
|
+
"qrlkit-darwin-arm64": "0.14.0",
|
|
13
|
+
"qrlkit-darwin-x64": "0.14.0",
|
|
14
|
+
"qrlkit-linux-arm64": "0.14.0",
|
|
15
|
+
"qrlkit-linux-x64": "0.14.0"
|
|
16
16
|
},
|
|
17
17
|
"os": [
|
|
18
18
|
"linux",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"bugs": {
|
|
35
35
|
"url": "https://github.com/qrlkit/qrlkit-rs/issues"
|
|
36
36
|
},
|
|
37
|
-
"version": "0.
|
|
37
|
+
"version": "0.14.0"
|
|
38
38
|
}
|