1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 06:37:46 +00:00

jc: fix instructions and make it a module

This commit is contained in:
RGBCube 2025-07-18 23:59:42 +03:00
parent 9482d0325a
commit 2b2a17d54b
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M
2 changed files with 3 additions and 11 deletions

View file

@ -30,5 +30,5 @@ automatically parses its output into a structured data format.
2. Source this module in your `config.nu`: 2. Source this module in your `config.nu`:
```nu ```nu
source ~/path/to/jc/mod.rs use modules/jc
``` ```

View file

@ -1,9 +1,5 @@
def --env "nu-complete jc" [] { def --env "nu-complete jc" [] {
if $env.__NU_COMPLETE_JC? != null { try {
return $env.__NU_COMPLETE_JC
}
let options = try {
let about = ^jc --about let about = ^jc --about
| from json | from json
@ -38,14 +34,10 @@ def --env "nu-complete jc" [] {
} catch { } catch {
[] []
} }
$env.__NU_COMPLETE_JC = $options
$options
} }
# Run `jc` (JSON Converter). # Run `jc` (JSON Converter).
export def --wrapped jc [...arguments: string@"nu-complete jc"]: [any -> table, any -> record, any -> string] { export def --wrapped main [...arguments: string@"nu-complete jc"]: [any -> table, any -> record, any -> string] {
let run = ^jc ...$arguments | complete let run = ^jc ...$arguments | complete
if $run.exit_code != 0 { if $run.exit_code != 0 {