qrlkit 0.9.3 → 0.10.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 +242 -54
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -186,105 +186,293 @@ State is stored in `$XDG_STATE_HOME/qrlkit/state.yaml` on Linux, falling back to
186
186
 
187
187
  ## Config syntax
188
188
 
189
- **URLs**
189
+ Each example replaces the previous one.
190
190
 
191
- Urls open in the default browser set in `qrlkit init` or `qrlkit set-browser`.
192
- Reserved key `browser` overrides it with options:
191
+ Resource arguments match every placeholder name.
192
+ CLI values follow argument declaration order.
193
193
 
194
- - `chrome`
195
- - `firefox`
196
- - `safari`
197
- - `edge`
198
- - `brave`
199
- - `chromium`
200
- - `arc`
201
- - `vivaldi`
202
- - `opera`
194
+ ### URLs
203
195
 
204
- Executable paths are also supported.
205
- Use `{}` to forward arguments to paths.
196
+ Open URLs in your default browser.
206
197
 
207
198
  ```toml
208
- [docs]
199
+ [repos]
200
+ open = "https://github.com/qrlkit/qrlkit-rs"
201
+ ```
202
+
203
+ Choose the repository with an argument.
204
+
205
+ ```toml
206
+ [repos]
207
+ open = "https://github.com/qrlkit/{repo}"
208
+ ```
209
+
210
+ Reuse an organization through a constant.
211
+
212
+ ```toml
213
+ [constants]
214
+ org = "qrlkit"
215
+
216
+ [repos]
217
+ open = "https://github.com/{constants.org}/{repo}"
218
+ ```
219
+
220
+ Add hints and override the browser.
221
+
222
+ ```toml
223
+ [constants]
224
+ org = "qrlkit"
225
+
226
+ [repos]
227
+ browser = "firefox"
228
+ # hint: Browse the source code
229
+ open = "https://github.com/{constants.org}/{repo}"
230
+ ```
231
+
232
+ Offer repository choices from a constant.
233
+
234
+ ```toml
235
+ [constants]
236
+ org = "qrlkit"
237
+ repos = ["qrlkit-rs", "qrlkit-web"]
238
+
239
+ [repos.open]
240
+ url = "https://github.com/{constants.org}/{repo}"
241
+ hint = "Browse the source code"
209
242
  browser = "firefox"
210
- fav = "https://some-docs-you-prefer-in-ff/{area}.com"
243
+ args = [
244
+ { name = "repo", enum = { ref = "constants.repos" } },
245
+ ]
246
+ ```
247
+
248
+ ```sh
249
+ qrlkit repos open qrlkit-rs # Open directly
250
+ qrlkit repos open # Choose interactively
211
251
  ```
212
252
 
213
- **files**
253
+ Supported browsers:
254
+ `chrome`, `firefox`, `safari`, `edge`, `brave`, `chromium`, `arc`, `vivaldi`, `opera`.
214
255
 
215
- Files use the default action set in `qrlkit init` or `qrlkit set-filehook`.
216
- If neither is used they just otherwise print the file path.
217
- Reserved key `filehook` overrides global behavior with a command using `$file` for the selected path.
218
- Use `{}` in paths to forward arguments.
256
+ Custom browser executable paths also work.
257
+
258
+ ### Files
259
+
260
+ Print file paths without configured hooks.
219
261
 
220
262
  ```toml
221
- [dotfiles]
263
+ [files]
264
+ readme = "~/dev/qrlkit-rs/README.md"
265
+ ```
266
+
267
+ Choose the project with an argument.
268
+
269
+ ```toml
270
+ [files]
271
+ readme = "~/dev/{repo}/README.md"
272
+ ```
273
+
274
+ Reuse your development directory across paths.
275
+
276
+ ```toml
277
+ [constants]
278
+ root = "~/dev"
279
+
280
+ [files]
281
+ readme = "{constants.root}/{repo}/README.md"
282
+ ```
283
+
284
+ Add hints and open your editor.
285
+
286
+ ```toml
287
+ [constants]
288
+ root = "~/dev"
289
+
290
+ [files]
222
291
  filehook = "nvim $file"
223
- edit = "~/.confg/{tool}/{file}"
292
+ readme = "{constants.root}/{repo}/README.md" # hint: Edit the project README
224
293
  ```
225
294
 
226
- **dirs**
295
+ Offer project choices before opening files.
296
+
297
+ ```toml
298
+ [constants]
299
+ root = "~/dev"
300
+
301
+ [files.readme]
302
+ url = "{constants.root}/{repo}/README.md"
303
+ hint = "Edit the project README"
304
+ filehook = "nvim $file"
305
+ args = [
306
+ { name = "repo", enum = ["qrlkit-rs", "qrlkit-web"] },
307
+ ]
308
+ ```
309
+
310
+ ```sh
311
+ qrlkit files readme qrlkit-rs # Open directly
312
+ qrlkit files readme # Choose interactively
313
+ ```
314
+
315
+ Set global defaults with `qrlkit set-filehook`.
316
+
317
+ ### Dirs
227
318
 
228
- Dirs use the default action set in `qrlkit init` or `qrlkit set-dirhook`.
229
- If neither is used they otherwise just `cd` into directory via shell integration.
230
- Reserved key `dirhook` overrides global behavior with a command using `$dir` for the selected path.
319
+ Change directories through the shell integration.
320
+
321
+ ```toml
322
+ [dirs]
323
+ project = "~/dev/qrlkit-rs"
324
+ ```
325
+
326
+ Choose the project with an argument.
231
327
 
232
328
  ```toml
233
329
  [dirs]
234
- dirhook = "cd $dir && tree -L 1"
235
330
  project = "~/dev/{repo}"
236
331
  ```
237
332
 
238
- **constants**
333
+ Reuse your development directory across projects.
334
+
335
+ ```toml
336
+ [constants]
337
+ root = "~/dev"
338
+
339
+ [dirs]
340
+ project = "{constants.root}/{repo}"
341
+ ```
342
+
343
+ Add hints and list directory contents.
344
+
345
+ ```toml
346
+ [constants]
347
+ root = "~/dev"
348
+
349
+ [dirs]
350
+ dirhook = "cd $dir && tree -L 1"
351
+ # hint: Enter and inspect the project
352
+ project = "{constants.root}/{repo}"
353
+ ```
239
354
 
240
- Define reusable strings or lists in `[constants]`. Use `{constants.name}` in paths and URLs. For shared values, put `[constants]` in `constants.toml` beside the state file and use `{global.name}`.
355
+ Offer project choices before changing directories.
241
356
 
242
357
  ```toml
243
358
  [constants]
244
359
  root = "~/dev"
245
- namespaces = ["dev", "staging", "prod"]
246
360
 
247
- [projects]
248
- api = "{constants.root}/api"
361
+ [dirs.project]
362
+ url = "{constants.root}/{repo}"
363
+ hint = "Enter and inspect the project"
364
+ dirhook = "cd $dir && tree -L 1"
365
+ args = [
366
+ { name = "repo", enum = ["qrlkit-rs", "qrlkit-web"] },
367
+ ]
368
+ ```
369
+
370
+ ```sh
371
+ qrlkit dirs project qrlkit-rs # Open directly
372
+ qrlkit dirs project # Choose interactively
249
373
  ```
250
374
 
251
- **scripts**
375
+ Set global defaults with `qrlkit set-dirhook`.
376
+
377
+ ### Scripts
252
378
 
253
- Scripts run in Bash by default from the config's directory.
254
- Reserved key `shell` overrides it with options `bash`, `sh`, and `zsh`.
255
- Use `$` notation to pass arguments. Use args to prompt users for inputs.
379
+ Run Bash from the config's directory.
256
380
 
257
381
  ```toml
258
- [kube.logs]
382
+ [greet]
383
+ run = 'printf "Hello, World!\n"'
384
+ ```
385
+
386
+ Prompt for missing arguments with `args`.
387
+
388
+ ```toml
389
+ [greet]
390
+ args = [{ name = "name" }]
391
+ run = 'printf "Hello, %s!\n" "$1"'
392
+ ```
393
+
394
+ Supply constants through `env` without prompting.
395
+
396
+ ```toml
397
+ [constants]
398
+ name = "World"
399
+
400
+ [greet]
401
+ run = 'printf "Hello, %s!\n" "$NAME"'
402
+
403
+ [greet.env]
404
+ NAME = "{constants.name}"
405
+ ```
406
+
407
+ Combine constant values with argument choices.
408
+
409
+ ```toml
410
+ [constants]
411
+ name = "World"
412
+ greetings = ["Hello", "Hi", "Hey"]
413
+
414
+ [greet]
259
415
  args = [
260
- { name = "namespace", enum = { ref = "constants.namespaces" } },
261
- { name = "pod" },
416
+ { name = "greeting", enum = { ref = "constants.greetings" } },
417
+ ]
418
+ run = 'printf "%s, %s!\n" "$1" "$NAME"'
419
+
420
+ [greet.env]
421
+ NAME = "{constants.name}"
422
+ ```
423
+
424
+ Add hints and choose your shell.
425
+
426
+ ```toml
427
+ [constants]
428
+ name = "World"
429
+ greetings = ["Hello", "Hi", "Hey"]
430
+
431
+ [greet]
432
+ hint = "Say hello with some personality"
433
+ shell = "zsh"
434
+ args = [
435
+ { name = "greeting", enum = { ref = "constants.greetings" } },
262
436
  ]
263
437
  run = '''
264
- kubectl logs --namespace "$1" "$2" --follow
438
+ printf '%s, %s!\n' "$1" "$NAME"
439
+ printf 'Have a lovely day!\n'
265
440
  '''
266
- shell = "zsh"
441
+
442
+ [greet.env]
443
+ NAME = "{constants.name}"
267
444
  ```
268
445
 
269
- **hints**
446
+ ```sh
447
+ qrlkit greet Hey
448
+ ```
270
449
 
271
- Comments with `hint: ` in them will be included in the terminal.
450
+ Supported shells: `bash`, `sh`, and `zsh`.
272
451
 
273
- ```toml
274
- [launch]
275
- # hint: Find your next mission
276
- issues = "https://github.com/ratatui/ratatui/issues"
452
+ ### Shared constants
277
453
 
278
- repo = "https://github.com/ratatui/ratatui" # hint: Browse the source code
454
+ Place `constants.toml` beside your state file.
455
+
456
+ ```toml
457
+ # constants.toml
458
+ [constants]
459
+ root = "~/dev"
460
+ name = "World"
279
461
  ```
280
462
 
281
- Run `qrlkit launch` after importing the config:
463
+ Reference shared constants with `{global.name}` syntax.
282
464
 
283
- ```text
284
- > issues Find your next mission
285
- repo Browse the source code
286
- ```
465
+ ```toml
466
+ # QRLs.toml
467
+ [dirs]
468
+ project = "{global.root}/{repo}"
287
469
 
470
+ [greet]
471
+ run = 'printf "Hello, %s!\n" "$NAME"'
472
+
473
+ [greet.env]
474
+ NAME = "{global.name}"
475
+ ```
288
476
 
289
477
  ## Contributing
290
478
 
package/package.json CHANGED
@@ -9,10 +9,10 @@
9
9
  "README.md"
10
10
  ],
11
11
  "optionalDependencies": {
12
- "qrlkit-darwin-arm64": "0.9.3",
13
- "qrlkit-darwin-x64": "0.9.3",
14
- "qrlkit-linux-arm64": "0.9.3",
15
- "qrlkit-linux-x64": "0.9.3"
12
+ "qrlkit-darwin-arm64": "0.10.1",
13
+ "qrlkit-darwin-x64": "0.10.1",
14
+ "qrlkit-linux-arm64": "0.10.1",
15
+ "qrlkit-linux-x64": "0.10.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.9.3"
37
+ "version": "0.10.1"
38
38
  }