just do everything i guess
This commit is contained in:
parent
1e7b7d1614
commit
54000cfafe
5 changed files with 268 additions and 16 deletions
19
flake.nix
19
flake.nix
|
|
@ -84,19 +84,24 @@
|
|||
$entries
|
||||
}
|
||||
"systemctl" => {
|
||||
if ($spans | length) < 2 { null } else {
|
||||
if ($spans | length) < 3 { null } else {
|
||||
let kw = $spans | last
|
||||
^systemctl list-units --all --no-pager --plain --full $"($kw)*"
|
||||
| detect columns
|
||||
| drop 7
|
||||
| headers
|
||||
| each { |r| {value: $r.UNIT, description: ($r.DESCRIPTION | default "")} }
|
||||
let scope = if ("--user" in $spans) { [--user] } else { [] }
|
||||
^systemctl ...$scope list-units --all --no-pager --plain --full --no-legend $"($kw)*"
|
||||
| lines
|
||||
| each { |l|
|
||||
let parsed = $l | parse -r '(?P<unit>\S+)\s+\S+\s+\S+\s+\S+\s+(?P<desc>.*)'
|
||||
if ($parsed | length) > 0 {
|
||||
{value: $parsed.0.unit, description: ($parsed.0.desc | str trim)}
|
||||
}
|
||||
} | compact
|
||||
}
|
||||
}
|
||||
_ => { null }
|
||||
}
|
||||
} else { null }
|
||||
$completions | append $additional
|
||||
let result = ($completions | default []) | append ($additional | default []) | compact
|
||||
if ($result | is-empty) { null } else { $result }
|
||||
}
|
||||
$env.config.completions.external = {enable: true, max_results: 200, completer: $inshellah_complete}
|
||||
'';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue