mirror of
https://github.com/RGBCube/ncc
synced 2025-07-30 19:47:47 +00:00
Use carapace properly
This commit is contained in:
parent
a20cab18bf
commit
8aad332ab9
2 changed files with 2 additions and 47 deletions
|
@ -124,49 +124,7 @@ $env.config.completions = {
|
||||||
partial: true
|
partial: true
|
||||||
quick: true
|
quick: true
|
||||||
external: {
|
external: {
|
||||||
enable: true
|
|
||||||
max_results: 100
|
max_results: 100
|
||||||
completer: {|tokens: list<string>|
|
|
||||||
let expanded_alias = scope aliases | where name == $tokens.0 | get --ignore-errors expansion.0
|
|
||||||
|
|
||||||
let tokens = if $expanded_alias != null {
|
|
||||||
$expanded_alias | split row " " | append ($tokens | skip 1)
|
|
||||||
} else {
|
|
||||||
$tokens
|
|
||||||
}
|
|
||||||
|
|
||||||
let command = $tokens.0 | str trim --left --char "^"
|
|
||||||
|
|
||||||
let completions = carapace $command nushell $tokens | from json | default []
|
|
||||||
|
|
||||||
if ($completions | is-empty) {
|
|
||||||
let path = $tokens | last
|
|
||||||
|
|
||||||
ls $"($path)*" | each {|it|
|
|
||||||
let choice = if ($path | str ends-with "/") {
|
|
||||||
$path | path join ($it.name | path basename)
|
|
||||||
} else {
|
|
||||||
$path | path dirname | path join ($it.name | path basename)
|
|
||||||
}
|
|
||||||
|
|
||||||
let choice = if ($it.type == "dir") and (not ($choice | str ends-with "/")) {
|
|
||||||
$"($choice)/"
|
|
||||||
} else {
|
|
||||||
$choice
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($choice | str contains " ") {
|
|
||||||
$"`($choice)`"
|
|
||||||
} else {
|
|
||||||
$choice
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ($completions | where value =~ "^.*ERR$" | is-empty) {
|
|
||||||
$completions
|
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
{ config, ulib, pkgs, upkgs, theme, ... }: with ulib; merge3
|
{ config, ulib, pkgs, upkgs, theme, ... }: with ulib; merge
|
||||||
|
|
||||||
(systemConfiguration {
|
(systemConfiguration {
|
||||||
users.defaultUserShell = pkgs.nushell;
|
users.defaultUserShell = pkgs.nushell;
|
||||||
})
|
})
|
||||||
|
|
||||||
(homeConfiguration {
|
(homeConfiguration {
|
||||||
|
programs.carapace = enabled {};
|
||||||
programs.starship = enabled {};
|
programs.starship = enabled {};
|
||||||
|
|
||||||
programs.nushell = enabled {
|
programs.nushell = enabled {
|
||||||
|
@ -31,7 +32,3 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(homePackages (with pkgs; [
|
|
||||||
carapace
|
|
||||||
]))
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue