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:
parent
9482d0325a
commit
2b2a17d54b
2 changed files with 3 additions and 11 deletions
|
@ -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
|
||||||
```
|
```
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue