fork/fish-shell

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

Johannes AltmanningerMerge branch 'completions-to-use-expanded-tokens'a9618477e

master
8.8 KiB126 linesraw
1set -l commands_need_user activate deactivate inspect authenticate remove update passwd resize lock unlock with
2set -l commands list create lock-all $commands_need_user
3
4function __homectl_users
5    homectl list | string match -r -- '\S+\s+\d+\s+\d+' | string match -r -- '\S+'
6end
7
8function __homectl_subcommand_is
9    set -l cmd (commandline -pxc)
10    contains -- $cmd[-1] $argv
11end
12
13# Commands
14complete -c homectl -f
15complete -c homectl -n "not __fish_seen_subcommand_from $commands" -a list -d 'List home areas'
16complete -c homectl -n "not __fish_seen_subcommand_from $commands" -a activate -d 'Activate a home area'
17complete -c homectl -n "not __fish_seen_subcommand_from $commands" -a deactivate -d 'Deactivate a home area'
18complete -c homectl -n "not __fish_seen_subcommand_from $commands" -a inspect -d 'Inspect a home area'
19complete -c homectl -n "not __fish_seen_subcommand_from $commands" -a authenticate -d 'Authenticate a home area'
20complete -c homectl -n "not __fish_seen_subcommand_from $commands" -a create -d 'Create a home area'
21complete -c homectl -n "not __fish_seen_subcommand_from $commands" -a remove -d 'Remove a home area'
22complete -c homectl -n "not __fish_seen_subcommand_from $commands" -a update -d 'Update a home area'
23complete -c homectl -n "not __fish_seen_subcommand_from $commands" -a passwd -d 'Change password of a home area'
24complete -c homectl -n "not __fish_seen_subcommand_from $commands" -a resize -d 'Resize a home area'
25complete -c homectl -n "not __fish_seen_subcommand_from $commands" -a lock -d 'Temporarily lock an active home area'
26complete -c homectl -n "not __fish_seen_subcommand_from $commands" -a unlock -d 'Unlock a temporarily locked home area'
27complete -c homectl -n "not __fish_seen_subcommand_from $commands" -a lock-all -d 'Lock all suitable home areas'
28complete -c homectl -n "not __fish_seen_subcommand_from $commands" -a with -d 'Run shell or command with access to a home area'
29complete -c homectl -n "__homectl_subcommand_is $commands_need_user" -xa '(__homectl_users)'
30
31# Options
32complete -c homectl -s h -l help -d 'Show this help'
33complete -c homectl -l version -d 'Show package version'
34complete -c homectl -l no-pager -d 'Do not pipe output into a pager'
35complete -c homectl -l no-legend -d 'Do not show the headers and footers'
36complete -c homectl -l no-ask-password -d 'Do not ask for system passwords'
37complete -c homectl -s H -l host -d 'Operate on remote host'
38complete -c homectl -s M -l machine -d 'Operate on local container'
39complete -c homectl -l identity -d 'Read JSON identity from file' -r
40complete -c homectl -l json -d 'Output inspection data in JSON' -xa 'pretty short off'
41complete -c homectl -s j -d 'Equivalent to --json (on TTY) or short (otherwise)'
42complete -c homectl -l export-format -d 'Strip JSON inspection data' -xa 'full stripped minimal'
43complete -c homectl -s E -d 'Equals -j --export-format (twice to minimal)'
44complete -c homectl -o EE -d 'Equals -j --export-format=minimal'
45
46# User Record Properties
47set -l condition '__fish_seen_subcommand_from create update'
48
49# General User Record Properties
50complete -c homectl -n $condition -s c -l real-name -d 'Real name for user'
51complete -c homectl -n $condition -l realm -d 'Realm to create user in'
52complete -c homectl -n $condition -l email-address -d 'Email address for user'
53complete -c homectl -n $condition -l location -d 'Set location of user on earth'
54complete -c homectl -n $condition -l icon-name -d 'Icon name for user'
55complete -c homectl -n $condition -s d -l home-dir -d 'Home directory' -r
56complete -c homectl -n $condition -s u -l uid -d 'Numeric UID for user'
57complete -c homectl -n $condition -s G -l member-of -d 'Add user to group'
58complete -c homectl -n $condition -l skel -d 'Skeleton directory to use' -r
59complete -c homectl -n $condition -l shell -d 'Shell for account' -xa "(string match -r '^[^#].*' < /etc/shells)"
60complete -c homectl -n $condition -l setenv -d 'Set an environment variable at log-in'
61complete -c homectl -n $condition -l timezone -d 'Set a time-zone'
62complete -c homectl -n $condition -l language -d 'Set preferred language'
63complete -c homectl -n $condition -l ssh-authorized-keys -d 'Specify SSH public keys'
64complete -c homectl -n $condition -l pkcs11-token-uri -d 'URI to PKCS#11 security token'
65complete -c homectl -n $condition -l fido2-device -d 'Path to FIDO2 hidraw device' -r
66
67# Account Management User Record Properties
68complete -c homectl -n $condition -l locked -d 'Set locked account state' -xa 'yes no'
69complete -c homectl -n $condition -l not-before -d 'Do not allow logins before'
70complete -c homectl -n $condition -l not-after -d 'Do not allow logins after'
71complete -c homectl -n $condition -l rate-limit-interval -d 'Login rate-limit interval in seconds'
72complete -c homectl -n $condition -l rate-limit-burst -d 'Login rate-limit attempts per interval'
73
74# Password Policy User Record Properties:
75complete -c homectl -n $condition -l password-hint -d 'Set Password hint'
76complete -c homectl -n $condition -l enforce-password-policy -d 'Control enforce password policy' -xa 'yes no'
77complete -c homectl -n $condition -s P -d 'Equivalent to --enforce-password-password=no'
78complete -c homectl -n $condition -l password-change-now -d 'Require the password to be changed on next login' -xa 'yes no'
79complete -c homectl -n $condition -l password-change-min -d 'Require minimum time between password changes'
80complete -c homectl -n $condition -l password-change-max -d 'Require maximum time between password changes'
81complete -c homectl -n $condition -l password-change-warn -d 'How much time to warn before password expiry'
82complete -c homectl -n $condition -l password-change-inactive -d 'How much time to block password after expiry'
83
84# Resource Management User Record Properties:
85complete -c homectl -n $condition -l disk-size -d 'Size to assign the user on disk'
86complete -c homectl -n $condition -l access-mode -d 'User home directory access mode'
87complete -c homectl -n $condition -l umask -d 'Umask for user when logging in'
88complete -c homectl -n $condition -l nice -d 'Nice level for user'
89complete -c homectl -n $condition -l rlimit -d 'Set resource limits'
90complete -c homectl -n $condition -l tasks-max -d 'Set maximum number of per-user tasks'
91complete -c homectl -n $condition -l memory-high -d 'Set high memory threshold in bytes'
92complete -c homectl -n $condition -l memory-max -d 'Set maximum memory limit'
93complete -c homectl -n $condition -l cpu-weight -d 'Set CPU weight'
94complete -c homectl -n $condition -l io-weight -d 'Set IO weight'
95
96# Storage User Record Properties:
97complete -c homectl -n $condition -l storage -d 'Storage type to use' -xa 'luks fscrypt directory subvolume cifs'
98complete -c homectl -n $condition -l image-path -d 'Path to image file/directory' -r
99
100# LUKS Storage User Record Properties:
101complete -c homectl -n $condition -l fs-type -d 'File system type to use in case of luks storage' -xa 'ext4 xfs btrfs'
102complete -c homectl -n $condition -l luks-discard -d 'Whether to use discard feature' -xa 'yes no'
103complete -c homectl -n $condition -l luks-offline-discard -d 'Whether to trim file on logout' -xa 'yes no'
104complete -c homectl -n $condition -l luks-cipher -d 'Cipher to use for LUKS encryption'
105complete -c homectl -n $condition -l luks-cipher-mode -d 'Cipher mode to use for LUKS encryption'
106complete -c homectl -n $condition -l luks-volume-key-size -d 'Volume key size to use for LUKS encryption'
107complete -c homectl -n $condition -l luks-pbkdf-type -d 'Password-based Key Derivation Function to use'
108complete -c homectl -n $condition -l luks-pbkdf-hash-algorithm -d 'PBKDF hash algorithm to use'
109complete -c homectl -n $condition -l luks-pbkdf-time-cost -d 'Time cost for PBKDF in seconds'
110complete -c homectl -n $condition -l luks-pbkdf-memory-cost -d 'Memory cost for PBKDF in bytes'
111complete -c homectl -n $condition -l luks-pbkdf-parallel-threads -d 'Number of parallel threads for PKBDF'
112
113# Mounting User Record Properties:
114complete -c homectl -n $condition -l nosuid -d 'Control the nosuid flag of the home mount' -xa 'yes no'
115complete -c homectl -n $condition -l nodev -d 'Control the nodev flag of the home mount' -xa 'yes no'
116complete -c homectl -n $condition -l noexec -d 'Control the noexec flag of the home mount' -xa 'yes no'
117
118# CIFS User Record Properties:
119complete -c homectl -n $condition -l cifs-domain -d 'CIFS (Windows) domain'
120complete -c homectl -n $condition -l cifs-user-name -d 'CIFS (Windows) user name'
121complete -c homectl -n $condition -l cifs-service -d 'CIFS (Windows) service to mount as home area'
122
123# Login Behaviour User Record Properties:
124complete -c homectl -n $condition -l stop-delay -d 'How long to leave user services running after logout'
125complete -c homectl -n $condition -l kill-processes -d 'Whether to kill user processes when sessions terminate' -xa 'yes no'
126complete -c homectl -n $condition -l auto-login -d 'Try to log this user in automatically' -xa 'yes no'