fish-shell/share/completions/dm-tool.fish
Johannes Altmanninger 330883b6fd Run fish_indent on share/**.fish
This is mostly to show that some of my following indent changes don't break
current behavior.
2021-02-08 07:31:33 +01:00

15 lines
912 B
Fish

# Completions for the dm-tool command (part of the lightdm display manager)
set -l cmds 'add-local-x-seat add-nested-seat add-seat list-seats lock switch-to-greeter switch-to-guest switch-to-user'
complete -c dm-tool -f
complete -c dm-tool -n "not __fish_seen_subcommand_from $cmds" -s h -l help -x -d "Show help options"
complete -c dm-tool -n "not __fish_seen_subcommand_from $cmds" -s v -l version -x -d "Show release version"
complete -c dm-tool -n "not __fish_seen_subcommand_from $cmds" -l session-bus -d "Connect using the session bus"
complete -c dm-tool -n "not __fish_seen_subcommand_from $cmds" -xa "$cmds"
# switch-to-user
set -l session_users "(dm-tool list-seats | string replace -rf '.*UserName=' '' | string trim -c '\'')"
set -l has_user "__fish_seen_subcommand_from $session_users"
complete -c dm-tool -n "__fish_seen_subcommand_from switch-to-user; and not $has_user" -xa "$session_users"