fork/fish-shell

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

Johannes AltmanningerPrepare to not localize private function descriptionsd835c5252

master
5.1 KiB98 linesraw
1# localization: tier3
2function __fish_complete_zfs_rw_properties
3    set -l OS ""
4    switch (uname)
5        case Linux
6            set OS Linux
7        case Darwin
8            set OS macOS
9        case FreeBSD
10            set OS FreeBSD
11        case SunOS
12            set OS SunOS
13            # Others?
14        case "*"
15            set OS unknown
16    end
17    echo -e "aclinherit\tInheritance of ACL entries (discard, noallow, restricted, passthrough, passthrough-x)"
18    echo -e "atime\tUpdate access time on read (on, off)"
19    echo -e "canmount\tIs the dataset mountable (on, off, noauto)"
20    set -l additional_algs ''
21    if contains -- $OS FreeBSD SunOS
22        set additional_algs "$additional_algs, noparity"
23    end
24    if __fish_is_zfs_feature_enabled "feature@sha512"
25        set additional_algs "$additional_algs, sha512"
26    end
27    if __fish_is_zfs_feature_enabled "feature@skein"
28        set additional_algs "$additional_algs, skein"
29    end
30    if __fish_is_zfs_feature_enabled "feature@edonr"
31        set additional_algs "$additional_algs, edonr"
32    end
33    echo -e "checksum\tData checksum (on, off, fletcher2, fletcher4, sha256$additional_algs)"
34    if __fish_is_zfs_feature_enabled "feature@lz4_compress"
35        set additional_algs ", lz4"
36    end
37    echo -e "compression\tCompression algorithm (on, off, lzjb$additional_algs, gzip, gzip-[1-9], zle)"
38    set -e additional_algs
39    echo -e "copies\tNumber of copies of data (1, 2, 3)"
40    echo -e "dedup\tDeduplication (on, off, verify, sha256[,verify])"
41    echo -e "devices\tAre contained device nodes openable (on, off)"
42    echo -e "exec\tCan contained executables be executed (on, off)"
43    echo -e "filesystem_limit\tMax number of filesystems and volumes (COUNT, none)"
44    echo -e "mountpoint\tMountpoint (PATH, none, legacy)"
45    echo -e "primarycache\tWhich data to cache in ARC (all, none, metadata)"
46    echo -e "quota\tMax size of dataset and children (SIZE, none)"
47    echo -e "snapshot_limit\tMax number of snapshots (COUNT, none)"
48    echo -e "readonly\tRead-only (on, off)"
49    echo -e "recordsize\tSuggest block size (SIZE)"
50    echo -e "redundant_metadata\tHow redundant are the metadata (all, most)"
51    echo -e "refquota\tMax space used by dataset itself (SIZE, none)"
52    echo -e "refreservation\tMin space guaranteed to dataset itself (SIZE, none)"
53    echo -e "reservation\tMin space guaranteed to dataset (SIZE, none)"
54    echo -e "secondarycache\tWhich data to cache in L2ARC (all, none, metadata)"
55    echo -e "setuid\tRespect set-UID bit (on, off)"
56    echo -e "sharenfs\tShare in NFS (on, off, OPTS)"
57    echo -e "logbias\tHint for handling of synchronous requests (latency, throughput)"
58    echo -e "snapdir\tHide .zfs directory (hidden, visible)"
59    echo -e "sync\tHandle of synchronous requests (standard, always, disabled)"
60    echo -e "volsize\tVolume logical size (SIZE)"
61
62    # Autogenerate userquota@$USER list; only usernames are supported by the completion, but the zfs command supports more formats
63    for user in (__fish_print_users)
64        set -l tabAndBefore (echo -e "userquota@$user\t")
65        printf "%sMax usage by user %s\n" $tabAndBefore $user
66    end
67    # Autogenerate groupquota@$USER list
68    for group in (__fish_print_groups)
69        set -l tabAndBefore (echo -e "groupquota@$group\t")
70        printf "%sMax usage by group %s\n" $tabAndBefore $group
71    end
72    if test $OS = SunOS
73        echo -e "aclmode\tHow is ACL modified by chmod (discard, groupmask, passthrough, restricted)"
74        echo -e "mlslabel\tCan the dataset be mounted in a zone with Trusted Extensions enabled (LABEL, none)"
75        echo -e "nbmand\tMount with Non Blocking mandatory locks (on, off)"
76        echo -e "sharesmb\tShare in Samba (on, off)"
77        echo -e "shareiscsi\tShare as an iSCSI target (on, off)"
78        echo -e "version\tOn-disk version of filesystem (1, 2, current)"
79        echo -e "vscan\tScan regular files for viruses on opening and closing (on, off)"
80        echo -e "xattr\tExtended attributes (on, off, sa)"
81        echo -e "zoned\tManaged from a non-global zone (on, off)"
82    else if test $OS = Linux
83        echo -e "acltype\tUse no ACL or POSIX ACL (noacl, posixacl)"
84        echo -e "nbmand\tMount with Non Blocking mandatory locks (on, off)"
85        echo -e "relatime\tSometimes update access time on read (on, off)"
86        echo -e "shareiscsi\tShare as an iSCSI target (on, off)"
87        echo -e "sharesmb\tShare in Samba (on, off)"
88        echo -e "snapdev\tHide volume snapshots (hidden, visible)"
89        echo -e "version\tOn-disk version of filesystem (1, 2, current)"
90        echo -e "vscan\tScan regular files for viruses on opening and closing (on, off)"
91        echo -e "xattr\tExtended attributes (on, off, sa)"
92    else if test $OS = FreeBSD
93        echo -e "aclmode\tHow is ACL modified by chmod (discard, groupmask, passthrough, restricted)"
94        echo -e "volmode\tHow to expose volumes to OS (default, geom, dev, none)"
95    end
96    # User properties; the /dev/null redirection masks the possible "no datasets available"
97    zfs list -o all 2>/dev/null | head -n 1 | string replace -a -r "\s+" "\n" | string match -e ":" | string lower
98end