qrlkit 0.11.0 → 0.12.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.
Files changed (2) hide show
  1. package/README.md +114 -132
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -193,63 +193,27 @@ State is stored in `$XDG_STATE_HOME/qrlkit/state.yaml` on Linux, falling back to
193
193
 
194
194
  ## Config syntax
195
195
 
196
- Each example replaces the previous one.
197
-
198
- Resource arguments match every placeholder name.
199
- CLI values follow argument declaration order.
200
-
201
196
  ### URLs
202
197
 
203
198
  Open URLs in your default browser.
204
199
 
205
200
  ```toml
206
201
  [repos]
207
- open = "https://github.com/qrlkit/qrlkit-rs"
208
- ```
209
-
210
- Choose the repository with an argument.
211
-
212
- ```toml
213
- [repos]
214
- open = "https://github.com/qrlkit/{repo}"
215
- ```
216
-
217
- Reuse an organization through a constant.
218
-
219
- ```toml
220
- [constants]
221
- org = "qrlkit"
222
-
223
- [repos]
224
- open = "https://github.com/{constants.org}/{repo}"
225
- ```
226
-
227
- Add hints and override the browser.
228
-
229
- ```toml
230
- [constants]
231
- org = "qrlkit"
232
-
233
- [repos]
234
- browser = "firefox"
235
- # hint: Browse the source code
236
- open = "https://github.com/{constants.org}/{repo}"
202
+ rs = "https://github.com/qrlkit/qrlkit-rs"
237
203
  ```
238
204
 
239
- Offer repository choices from a constant.
205
+ Or go advanced with reuseable constants and hints.
240
206
 
241
207
  ```toml
242
- [constants]
208
+ [const]
209
+ hidden = true
243
210
  org = "qrlkit"
244
211
  repos = ["qrlkit-rs", "qrlkit-web"]
245
212
 
246
213
  [repos.open]
247
- url = "https://github.com/{constants.org}/{repo}"
214
+ url = "https://github.com/{const.org}/{const.repos}"
248
215
  hint = "Browse the source code"
249
216
  browser = "firefox"
250
- args = [
251
- { name = "repo", enum = { ref = "constants.repos" } },
252
- ]
253
217
  ```
254
218
 
255
219
  ```sh
@@ -271,47 +235,18 @@ Print file paths without configured hooks.
271
235
  readme = "~/dev/qrlkit-rs/README.md"
272
236
  ```
273
237
 
274
- Choose the project with an argument.
238
+ Or beef it up with reuseable constants, hints and a custom filehook:
275
239
 
276
240
  ```toml
277
- [files]
278
- readme = "~/dev/{repo}/README.md"
279
- ```
280
-
281
- Reuse your development directory across paths.
282
-
283
- ```toml
284
- [constants]
285
- root = "~/dev"
286
-
287
- [files]
288
- readme = "{constants.root}/{repo}/README.md"
289
- ```
290
-
291
- Add hints and open your editor.
292
-
293
- ```toml
294
- [constants]
295
- root = "~/dev"
296
-
297
- [files]
298
- filehook = "nvim $file"
299
- readme = "{constants.root}/{repo}/README.md" # hint: Edit the project README
300
- ```
301
-
302
- Offer project choices before opening files.
303
-
304
- ```toml
305
- [constants]
241
+ [const]
242
+ hidden = true
306
243
  root = "~/dev"
244
+ repos = ["qrlkit-rs", "qrlkit-web"]
307
245
 
308
246
  [files.readme]
309
- url = "{constants.root}/{repo}/README.md"
247
+ url = "{const.root}/{const.repos}/README.md"
310
248
  hint = "Edit the project README"
311
249
  filehook = "nvim $file"
312
- args = [
313
- { name = "repo", enum = ["qrlkit-rs", "qrlkit-web"] },
314
- ]
315
250
  ```
316
251
 
317
252
  ```sh
@@ -319,59 +254,27 @@ qrlkit files readme qrlkit-rs # Open directly
319
254
  qrlkit files readme # Choose interactively
320
255
  ```
321
256
 
322
- Set global defaults with `qrlkit set-filehook`.
323
-
324
257
  ### Dirs
325
258
 
326
- Change directories through the shell integration.
259
+ By default you can `cd` into a dir:
327
260
 
328
261
  ```toml
329
262
  [dirs]
330
263
  project = "~/dev/qrlkit-rs"
331
264
  ```
332
265
 
333
- Choose the project with an argument.
266
+ Or mod it similarly to files and urls with consts, dirhooks and hints:
334
267
 
335
268
  ```toml
336
- [dirs]
337
- project = "~/dev/{repo}"
338
- ```
339
-
340
- Reuse your development directory across projects.
341
-
342
- ```toml
343
- [constants]
344
- root = "~/dev"
345
-
346
- [dirs]
347
- project = "{constants.root}/{repo}"
348
- ```
349
-
350
- Add hints and list directory contents.
351
-
352
- ```toml
353
- [constants]
354
- root = "~/dev"
355
-
356
- [dirs]
357
- dirhook = "cd $dir && tree -L 1"
358
- # hint: Enter and inspect the project
359
- project = "{constants.root}/{repo}"
360
- ```
361
-
362
- Offer project choices before changing directories.
363
-
364
- ```toml
365
- [constants]
269
+ [const]
270
+ hidden = true
366
271
  root = "~/dev"
272
+ repos = ["qrlkit-rs", "qrlkit-web"]
367
273
 
368
274
  [dirs.project]
369
- url = "{constants.root}/{repo}"
275
+ url = "{shared.root}/{shared.repos}"
370
276
  hint = "Enter and inspect the project"
371
277
  dirhook = "cd $dir && tree -L 1"
372
- args = [
373
- { name = "repo", enum = ["qrlkit-rs", "qrlkit-web"] },
374
- ]
375
278
  ```
376
279
 
377
280
  ```sh
@@ -379,8 +282,6 @@ qrlkit dirs project qrlkit-rs # Open directly
379
282
  qrlkit dirs project # Choose interactively
380
283
  ```
381
284
 
382
- Set global defaults with `qrlkit set-dirhook`.
383
-
384
285
  ### Scripts
385
286
 
386
287
  Run Bash from the config's directory.
@@ -398,40 +299,43 @@ args = [{ name = "name" }]
398
299
  run = 'printf "Hello, %s!\n" "$1"'
399
300
  ```
400
301
 
401
- Supply constants through `env` without prompting.
302
+ Supply fixed values through `env` without prompting.
402
303
 
403
304
  ```toml
404
- [constants]
305
+ [shared]
306
+ hidden = true
405
307
  name = "World"
406
308
 
407
309
  [greet]
408
310
  run = 'printf "Hello, %s!\n" "$NAME"'
409
311
 
410
312
  [greet.env]
411
- NAME = "{constants.name}"
313
+ NAME = "{shared.name}"
412
314
  ```
413
315
 
414
- Combine constant values with argument choices.
316
+ Combine shared values with argument choices.
415
317
 
416
318
  ```toml
417
- [constants]
319
+ [shared]
320
+ hidden = true
418
321
  name = "World"
419
322
  greetings = ["Hello", "Hi", "Hey"]
420
323
 
421
324
  [greet]
422
325
  args = [
423
- { name = "greeting", enum = { ref = "constants.greetings" } },
326
+ { name = "greeting", enum = { ref = "shared.greetings" } },
424
327
  ]
425
328
  run = 'printf "%s, %s!\n" "$1" "$NAME"'
426
329
 
427
330
  [greet.env]
428
- NAME = "{constants.name}"
331
+ NAME = "{shared.name}"
429
332
  ```
430
333
 
431
334
  Add hints and choose your shell.
432
335
 
433
336
  ```toml
434
- [constants]
337
+ [shared]
338
+ hidden = true
435
339
  name = "World"
436
340
  greetings = ["Hello", "Hi", "Hey"]
437
341
 
@@ -439,7 +343,7 @@ greetings = ["Hello", "Hi", "Hey"]
439
343
  hint = "Say hello with some personality"
440
344
  shell = "zsh"
441
345
  args = [
442
- { name = "greeting", enum = { ref = "constants.greetings" } },
346
+ { name = "greeting", enum = { ref = "shared.greetings" } },
443
347
  ]
444
348
  run = '''
445
349
  printf '%s, %s!\n' "$1" "$NAME"
@@ -447,7 +351,7 @@ printf 'Have a lovely day!\n'
447
351
  '''
448
352
 
449
353
  [greet.env]
450
- NAME = "{constants.name}"
354
+ NAME = "{shared.name}"
451
355
  ```
452
356
 
453
357
  ```sh
@@ -456,31 +360,109 @@ qrlkit greet Hey
456
360
 
457
361
  Supported shells: `bash`, `sh`, and `zsh`.
458
362
 
459
- ### Shared constants
363
+ ### Shared values
460
364
 
461
- Place `constants.toml` beside your state file.
365
+ Put shared values in any config and register it with `qrlkit add`.
462
366
 
463
367
  ```toml
464
- # constants.toml
465
- [constants]
368
+ # shared.toml
369
+ [shared]
370
+ hidden = true
466
371
  root = "~/dev"
467
372
  name = "World"
468
373
  ```
469
374
 
470
- Reference shared constants with `{global.name}` syntax.
375
+ ```sh
376
+ qrlkit add shared.toml
377
+ ```
378
+
379
+ Reference them from other registered configs.
471
380
 
472
381
  ```toml
473
382
  # QRLs.toml
474
383
  [dirs]
475
- project = "{global.root}/{repo}"
384
+ project = "{shared.root}/{repo}"
476
385
 
477
386
  [greet]
478
387
  run = 'printf "Hello, %s!\n" "$NAME"'
479
388
 
480
389
  [greet.env]
481
- NAME = "{global.name}"
390
+ NAME = "{shared.name}"
391
+ ```
392
+
393
+ ### Composition
394
+
395
+ Reference another resource's target without opening it.
396
+
397
+ ```toml
398
+ # Reference another QRL's value or URL
399
+ url = "{project.home}/issues"
400
+ ```
401
+
402
+ ```toml
403
+ # Use a script's output
404
+ [branch]
405
+ run = "git branch --show-current"
406
+
407
+ [compare]
408
+ url = "{project.home}/compare/main...{branch}"
409
+ ```
410
+
411
+ ```toml
412
+ # Look up a value using one selector
413
+ [project]
414
+ environment = ["staging", "production"]
415
+
416
+ [open]
417
+ url = "https://{hosts[project.environment]}.example.com"
482
418
  ```
483
419
 
420
+ ```toml
421
+ # Walk a nested mapping using multiple selectors
422
+ [project]
423
+ name = ["api", "web"]
424
+ environment = ["staging", "production"]
425
+
426
+ [open]
427
+ url = "https://{hosts[project.name, project.environment]}.example.com"
428
+ ```
429
+
430
+ Missing references and circular dependencies are errors.
431
+
432
+ ### Hints and hidden groups
433
+
434
+ Hide a group from pickers with `hidden = true`. Its values can still be referenced
435
+ or called directly. Add hints to groups, tools, lists, and individual choices.
436
+
437
+ ```toml
438
+ [projects]
439
+ hidden = true
440
+
441
+ [projects.repos]
442
+ hint = "Choose a qrlkit project"
443
+ values = [
444
+ { value = "qrlkit-rs", hint = "Rust CLI" },
445
+ { value = "qrlkit-web", hint = "Documentation website" },
446
+ ]
447
+
448
+ [repos]
449
+ hint = "GitHub resources"
450
+
451
+ [repos.open]
452
+ hint = "Browse the repository"
453
+ url = "https://github.com/qrlkit/{projects.repos}"
454
+ ```
455
+
456
+ ```sh
457
+ repos open # Choose a repository with hints
458
+ projects repos # Choose and print a value from the hidden group
459
+ ```
460
+
461
+ Use `values = ["qrlkit-rs", "qrlkit-web"]` when only the list needs a hint.
462
+ Each tool keeps its own hint when composing resources.
463
+
464
+ See [examples/composition.toml](examples/composition.toml) for a complete config.
465
+
484
466
  ## Themes
485
467
 
486
468
  Make the picker fit your terminal.
package/package.json CHANGED
@@ -9,10 +9,10 @@
9
9
  "README.md"
10
10
  ],
11
11
  "optionalDependencies": {
12
- "qrlkit-darwin-arm64": "0.11.0",
13
- "qrlkit-darwin-x64": "0.11.0",
14
- "qrlkit-linux-arm64": "0.11.0",
15
- "qrlkit-linux-x64": "0.11.0"
12
+ "qrlkit-darwin-arm64": "0.12.1",
13
+ "qrlkit-darwin-x64": "0.12.1",
14
+ "qrlkit-linux-arm64": "0.12.1",
15
+ "qrlkit-linux-x64": "0.12.1"
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.11.0"
37
+ "version": "0.12.1"
38
38
  }