From 2b2a17d54ba3157374a4b93fbe24823e562e7107 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Fri, 18 Jul 2025 23:59:42 +0300 Subject: [PATCH] jc: fix instructions and make it a module --- modules/jc/README.md | 2 +- modules/jc/mod.nu | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/modules/jc/README.md b/modules/jc/README.md index a26c442..64914a9 100644 --- a/modules/jc/README.md +++ b/modules/jc/README.md @@ -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 ``` diff --git a/modules/jc/mod.nu b/modules/jc/mod.nu index 2f56187..4e8a497 100644 --- a/modules/jc/mod.nu +++ b/modules/jc/mod.nu @@ -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 {