fork/fish-shell

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

Johannes AltmanningerPrepare to not localize private function descriptionsd835c5252

master
4.5 KiB165 linesraw
1# localization: tier3
2function __fish_print_user_ids
3    if command -sq getent
4        for line in (getent passwd)
5            set -l v (string split : -- $line)
6            printf "%s\t%s\n" $v[3] $v[1]
7        end
8    end
9end
10
11function __fish_print_group_ids
12    if command -sq getent
13        for line in (getent group)
14            set -l v (string split : -- $line)
15            printf "%s\t%s\n" $v[3] $v[1]
16        end
17    end
18end
19
20function __fish_complete_mount_opts
21    set -l fish_mount_opts \
22        async\t'Use asynchronous I/O' \
23        atime\t'Update time on each access' \
24        noatime\t'Do not update time on each access' \
25        auto\t'Mounted with' \
26        noauto\t'Not mounted by -a' \
27        defaults\t'Use default options' \
28        dev\t'Interpret character/block special devices' \
29        nodev\t'Do not interpret character/block special devices' \
30        diratime\t'Update directory inode access time' \
31        nodiratime\t'Don\'t update directory inode access time' \
32        dirsync\t'Use synchronous directory operations' \
33        exec\t'Permit executables' \
34        noexec\t'Do not permit executables' \
35        group\t'Any user within device group may mount' \
36        iversion\t'Increment i_version field on inode modification' \
37        noiversion\t'Don\'t increment i_version field on inode modification' \
38        mand\t'Allow mandatory locks' \
39        nomand\t'Don\'t allow mandatory locks' \
40        _netdev\t'Filesystem uses network' \
41        nofail\t'Don\'t report errors' \
42        relatime\t'Update inode access times' \
43        norelatime\t'Don\'t update inode access times' \
44        strictatime \
45        nostrictatime \
46        lazytime \
47        nolazytime \
48        suid\t'Allow suid bits' \
49        nosuid\t'Ignore suid bits' \
50        silent \
51        loud \
52        owner \
53        remount\t'Remount read-only filesystem' \
54        ro\t'Mount read-only' \
55        rw\t'Mount read-write' \
56        sync\t'Use synchronous I/O' \
57        user\t'Any user may mount' \
58        nouser\t'Only root may mount' \
59        users\t'Any user may mount and unmount' \
60        protect \
61        usemp \
62        verbose \
63        {grp,no,usr,}quota \
64        autodefrag \
65        compress \
66        compress-force \
67        degraded \
68        discard \
69        enospc_debug \
70        flushoncommit \
71        inode_cache \
72        context=\t'Set SELinux context' \
73        uid= \
74        gid= \
75        ownmask= \
76        othmask= \
77        setuid= \
78        setgid= \
79        mode= \
80        prefix= \
81        volume= \
82        reserved= \
83        root= \
84        bs= \
85        alloc_start= \
86        check_int{,_data,_print,_mask}= \
87        commit= \
88        compress= \
89        compress-force= \
90        device= \
91        fatal_errors= \
92        max_inline= \
93        metadata_ratio= \
94        noacl \
95        nobarrier \
96        nodatacow \
97        nodatasum \
98        notreelog \
99        recovery \
100        rescan_uuid_tree \
101        skip_balance \
102        nospace_cache \
103        clear_cache \
104        ssd \
105        nossd \
106        ssd_spread \
107        subvol= \
108        subvolrootid= \
109        thread_pool= \
110        user_subvol_rm_allowed \
111        acl \
112        noacl \
113        bsddf \
114        minixdf \
115        check=none \
116        nocheck \
117        debug \
118        errors={continue,remount-ro,panic} \
119        grpid \
120        bsdgroups \
121        bsdgroups \
122        bsdgroups \
123        nouid32 \
124        grpquota \
125        grpquota \
126        resgid= \
127        resuid= \
128        sb= \
129        {user,nouser}_xattr \
130        journal={update,unum} \
131        journal{_dev,_path}= \
132        norecovery \
133        noload \
134        data={journal,ordered,writeback} \
135        data_err={ignore,abort} \
136        barrier={0,1} \
137        user_xattr \
138        acl
139
140    set -l token (commandline -tc | string replace -r '^-o' -- '')
141    set -l args (string split , -- $token)
142
143    if test (count $args) -ne 0
144        set -l last_arg $args[-1]
145        set -e args[-1]
146
147        switch (string replace -r '=.*' '=' -- $last_arg)
148            case uid=
149                set -a fish_mount_opts uid=(__fish_print_user_ids)
150            case gid=
151                set -a fish_mount_opts gid=(__fish_print_group_ids)
152            case setuid=
153                set -a fish_mount_opts setuid=(__fish_print_user_ids)
154            case setgid=
155                set -a fish_mount_opts setgid=(__fish_print_group_ids)
156        end
157    end
158
159    set -l prefix ''
160    if set -q args[1]
161        set prefix (string join , -- $args),
162    end
163
164    printf '%s\n' $prefix$fish_mount_opts
165end