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`:
```nu
source ~/path/to/jc/mod.rs
use modules/jc
```

View file

@ -1,9 +1,5 @@
def --env "nu-complete jc" [] {
if $env.__NU_COMPLETE_JC? != null {
return $env.__NU_COMPLETE_JC
}
let options = try {
try {
let about = ^jc --about
| from json
@ -38,14 +34,10 @@ def --env "nu-complete jc" [] {
} catch {
[]
}
$env.__NU_COMPLETE_JC = $options
$options
}
# 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
if $run.exit_code != 0 {