diff options
| author | WriterV2 <primary-v2@protonmail.com> | 2026-10-04 13:34:34 +0200 |
|---|---|---|
| committer | WriterV2 <primary-v2@protonmail.com> | 2026-10-04 13:34:34 +0200 |
| commit | b9c2191d25ac50c1b71d17dab1eec8cc3d9433cb (patch) | |
| tree | cb41d0ef43c1c008f9e543fc000d6c7fa8b6ef49 /.config/nushell/config.nu | |
| parent | 7f036a51567cc1fe857bc7c162b5d863efeb3a41 (diff) | |
Nushell: Update fish completer config to replace deprecated `spans` with `$place.command`
Diffstat (limited to '.config/nushell/config.nu')
| -rw-r--r-- | .config/nushell/config.nu | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/.config/nushell/config.nu b/.config/nushell/config.nu index 0955ef7..3461d15 100644 --- a/.config/nushell/config.nu +++ b/.config/nushell/config.nu @@ -1,7 +1,15 @@ -let completer = {|spans| - fish --command $'complete "--do-complete=($spans | str join " ")"' +let completer = {|place| + fish --command $"complete '--do-complete=($place.command | str replace --all "'" "\\'" | str join ' ')'" | from tsv --flexible --noheaders --no-infer | rename value description + | update value {|row| + let value = $row.value + let need_quote = ['\' ',' '[' ']' '(' ')' ' ' '\t' "'" '"' "`"] | any {$in in $value} + if ($need_quote and ($value | path exists)) { + let expanded_path = if ($value starts-with '~') {$value | path expand --no-symlink} else {$value} + $'"($expanded_path | str replace --all "\"" "\\\"")"' + } else {$value} + } } let dark_theme = { |
