File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 11def --env "nu-complete jc" [commandline : string ] {
2- try {
2+ let stor = stor open
3+
4+ if $stor.jc_completions ? == null {
5+ stor create -- table-name jc_completions -- columns { value : str , description: str }
6+ }
7+
8+ if $stor.jc_completions_ran ? == null {
9+ stor create -- table-name jc_completions_ran -- columns { _ : bool }
10+ }
11+
12+ if $stor.jc_completions_ran != [] {
13+ return $stor.jc_completions
14+ } else {
15+ stor insert -- table-name jc_completions_ran -- data-record { _ : true }
16+ }
17+
18+ let completions = try {
319 let about = ^ jc -- about
420 | from json
521
@@ -38,6 +54,12 @@ def --env "nu-complete jc" [commandline: string] {
3854 } catch {
3955 []
4056 }
57+
58+ for entry in $completions {
59+ stor insert -- table-name jc_completions -- data-record $entry
60+ }
61+
62+ $completions
4163}
4264
4365# Run `jc` (JSON Converter).
You can’t perform that action at this time.
0 commit comments