fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes AltmanningerFix stale name of --tokens-expand option33a9659cd

master
4.7 KiB48 linesraw
1function __fish_lxc_no_subcommand -d 'Test if lxc has yet to be given the command'
2    for i in (commandline --tokens-expanded --cut-at-cursor --current-process)
3        if contains -- $i config console copy delete exec file help image info launch list move network pause profile publish remote rename restart restore shell snapshot start stop
4            return 1
5        end
6    end
7    return 0
8end
9
10function __fish_lxc_list_containers
11    lxc list -c n | string match -r '\| [a-zA-Z0-9_-]+' | string replace -r '\| ' ''
12end
13
14complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments config -d 'Manage configuration.'
15complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments console -d 'Attach to instance console.'
16complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments copy -d 'Copy containers within or in between lxd instances.'
17complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments delete -d 'Delete containers or snapshots.'
18complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments exec -d 'Execute the specified command in a container.'
19complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments file -d 'Manage files on a container.'
20complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments finger -d 'Check if the LXD instance is up.'
21complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments help -d 'Print help.'
22complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments image -d 'Manipulate container images.'
23complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments info -d 'List information on LXD servers and containers.'
24complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments init -d 'Initialize a container from a particular image.'
25complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments launch -d 'Launch a container from a particular image.'
26complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments list -d 'Lists the available resources.'
27complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments manpage -d 'Prints all the subcommands help.'
28complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments monitor -d 'Monitor activity on the LXD server.'
29complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments move -d 'Move containers within or in between lxd instances.'
30complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments network -d 'Manage networks.'
31complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments pause -d 'Changes state of one or more containers to pause.'
32complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments profile -d 'Manage configuration profiles.'
33complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments publish -d 'Publish containers as images.'
34complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments remote -d 'Manage remote LXD servers.'
35complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments rename -d 'Rename instance or snapshot.'
36complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments restart -d 'Changes state of one or more containers to restart.'
37complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments restore -d 'Set the current state of a container back to a snapshot.'
38complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments shell -d 'Execute commands in instance.'
39complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments snapshot -d 'Create a read-only snapshot of a container.'
40complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments start -d 'Changes state of one or more containers to start.'
41complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments stop -d 'Changes state of one or more containers to stop.'
42complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments version -d 'Prints the version number of this client tool.'
43
44# config
45complete --condition '__fish_seen_subcommand_from config' --command lxc --no-files --arguments "device get set unset show edit trust"
46
47set -l subcommands_taking_name console copy delete exec export info move pause publish rename restart restore shell snapshot start stop
48complete --condition "__fish_seen_subcommand_from $subcommands_taking_name" --command lxc --no-files --arguments "(__fish_lxc_list_containers)"