mirror of
https://github.com/RGBCube/ncc
synced 2025-08-01 12:37:46 +00:00
Compare commits
4 commits
b4919a5990
...
e3096645a8
Author | SHA1 | Date | |
---|---|---|---|
e3096645a8 | |||
fd49444afe | |||
9da7ad1439 | |||
a8cec1de3c |
2 changed files with 71 additions and 2 deletions
|
@ -24,6 +24,65 @@ def --env mcg [path: path]: nothing -> nothing {
|
||||||
jj git init --colocate
|
jj git init --colocate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def --env "nu-complete jc" [] {
|
||||||
|
if $env.__NU_COMPLETE_JC? != null {
|
||||||
|
return $env.__NU_COMPLETE_JC
|
||||||
|
}
|
||||||
|
|
||||||
|
let options = try {
|
||||||
|
let options = ^jc --help
|
||||||
|
| collect
|
||||||
|
| parse "{_}Parsers:\n{_}\n\nOptions:\n{inherent}\n\nSlice:{_}"
|
||||||
|
| get 0
|
||||||
|
|
||||||
|
let parsers = ^jc --about
|
||||||
|
| from json
|
||||||
|
| get parsers
|
||||||
|
| select argument description
|
||||||
|
| rename value description
|
||||||
|
|
||||||
|
let inherent = $options.inherent
|
||||||
|
| lines
|
||||||
|
| parse " {short}, {long} {description}"
|
||||||
|
| update description { str trim }
|
||||||
|
| each {|record|
|
||||||
|
[[value, description];
|
||||||
|
[$record.short, $record.description],
|
||||||
|
[$record.long, $record.description]]
|
||||||
|
}
|
||||||
|
| flatten
|
||||||
|
|
||||||
|
$parsers ++ $inherent
|
||||||
|
} catch {
|
||||||
|
[]
|
||||||
|
}
|
||||||
|
|
||||||
|
$env.__NU_COMPLETE_JC = $options
|
||||||
|
|
||||||
|
$options
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run `jc` (JSON Converter).
|
||||||
|
def --wrapped jc [...arguments: string@"nu-complete jc"]: [any -> table, any -> record, any -> string] {
|
||||||
|
let run = ^jc ...$arguments | complete
|
||||||
|
|
||||||
|
if $run.exit_code != 0 {
|
||||||
|
error make {
|
||||||
|
msg: "jc exection failed"
|
||||||
|
label: {
|
||||||
|
text: ($run.stderr | str replace "jc:" "" | str replace "Error -" "" | str trim)
|
||||||
|
span: (metadata $arguments).span
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if "--help" in $arguments or "-h" in $arguments {
|
||||||
|
$run.stdout
|
||||||
|
} else {
|
||||||
|
$run.stdout | from json
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# `nu-highlight` with default colors
|
# `nu-highlight` with default colors
|
||||||
#
|
#
|
||||||
# Custom themes can produce a lot more ansi color codes and make the output
|
# Custom themes can produce a lot more ansi color codes and make the output
|
||||||
|
@ -295,9 +354,18 @@ let menus = [
|
||||||
marker: $env.PROMPT_INDICATOR
|
marker: $env.PROMPT_INDICATOR
|
||||||
type: {
|
type: {
|
||||||
layout: ide
|
layout: ide
|
||||||
border: false
|
min_completion_width: 0
|
||||||
correct_cursor_pos: true
|
max_completion_width: 150
|
||||||
max_completion_height: 25
|
max_completion_height: 25
|
||||||
|
padding: 0
|
||||||
|
border: false
|
||||||
|
cursor_offset: 0
|
||||||
|
description_mode: "prefer_right"
|
||||||
|
min_description_width: 0
|
||||||
|
max_description_width: 50
|
||||||
|
max_description_height: 10
|
||||||
|
description_offset: 1
|
||||||
|
correct_cursor_pos: true
|
||||||
}
|
}
|
||||||
style: {
|
style: {
|
||||||
text: white
|
text: white
|
||||||
|
|
|
@ -14,6 +14,7 @@ in {
|
||||||
fastfetch
|
fastfetch
|
||||||
fd
|
fd
|
||||||
hyperfine
|
hyperfine
|
||||||
|
jc
|
||||||
moreutils
|
moreutils
|
||||||
openssl
|
openssl
|
||||||
p7zip
|
p7zip
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue