File: __fish_complete_zfs_rw_properties.fish

package info (click to toggle)
fish 3.1.2-3%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 38,672 kB
  • sloc: ansic: 80,259; cpp: 47,069; javascript: 17,087; sh: 6,163; python: 3,429; makefile: 669; perl: 367; objc: 78; xml: 18
file content (97 lines) | stat: -rw-r--r-- 5,620 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
function __fish_complete_zfs_rw_properties -d "Completes with ZFS read-write properties"
    set -l OS ""
    switch (uname)
        case Linux
            set OS "Linux"
        case Darwin
            set OS "macOS"
        case FreeBSD
            set OS "FreeBSD"
        case SunOS
            set OS "SunOS"
            # Others?
        case "*"
            set OS "unknown"
    end
    echo -e "aclinherit\t"(_ "Inheritance of ACL entries")" (discard, noallow, restricted, passthrough, passthrough-x)"
    echo -e "atime\t"(_ "Update access time on read")" (on, off)"
    echo -e "canmount\t"(_ "Is the dataset mountable")" (on, off, noauto)"
    set -l additional_algs ''
    if contains -- $OS FreeBSD SunOS
        set additional_algs "$additional_algs, noparity"
    end
    if __fish_is_zfs_feature_enabled "feature@sha512"
        set additional_algs "$additional_algs, sha512"
    end
    if __fish_is_zfs_feature_enabled "feature@skein"
        set additional_algs "$additional_algs, skein"
    end
    if __fish_is_zfs_feature_enabled "feature@edonr"
        set additional_algs "$additional_algs, edonr"
    end
    echo -e "checksum\t"(_ "Data checksum")" (on, off, fletcher2, fletcher4, sha256$additional_algs)"
    if __fish_is_zfs_feature_enabled "feature@lz4_compress"
        set additional_algs ", lz4"
    end
    echo -e "compression\t"(_ "Compression algorithm")" (on, off, lzjb$additional_algs, gzip, gzip-[1-9], zle)"
    set -e additional_algs
    echo -e "copies\t"(_ "Number of copies of data")" (1, 2, 3)"
    echo -e "dedup\t"(_ "Deduplication")" (on, off, verify, sha256[,verify])"
    echo -e "devices\t"(_ "Are contained device nodes openable")" (on, off)"
    echo -e "exec\t"(_ "Can contained executables be executed")" (on, off)"
    echo -e "filesystem_limit\t"(_ "Max number of filesystems and volumes")" (COUNT, none)"
    echo -e "mountpoint\t"(_ "Mountpoint")" (PATH, none, legacy)"
    echo -e "primarycache\t"(_ "Which data to cache in ARC")" (all, none, metadata)"
    echo -e "quota\t"(_ "Max size of dataset and children")" (SIZE, none)"
    echo -e "snapshot_limit\t"(_ "Max number of snapshots")" (COUNT, none)"
    echo -e "readonly\t"(_ "Read-only")" (on, off)"
    echo -e "recordsize\t"(_ "Suggest block size")" (SIZE)"
    echo -e "redundant_metadata\t"(_ "How redundant are the metadata")" (all, most)"
    echo -e "refquota\t"(_ "Max space used by dataset itself")" (SIZE, none)"
    echo -e "refreservation\t"(_ "Min space guaranteed to dataset itself")" (SIZE, none)"
    echo -e "reservation\t"(_ "Min space guaranteed to dataset")" (SIZE, none)"
    echo -e "secondarycache\t"(_ "Which data to cache in L2ARC")" (all, none, metadata)"
    echo -e "setuid\t"(_ "Respect set-UID bit")" (on, off)"
    echo -e "sharenfs\t"(_ "Share in NFS")" (on, off, OPTS)"
    echo -e "logbias\t"(_ "Hint for handling of synchronous requests")" (latency, throughput)"
    echo -e "snapdir\t"(_ "Hide .zfs directory")" (hidden, visible)"
    echo -e "sync\t"(_ "Handle of synchronous requests")" (standard, always, disabled)"
    echo -e "volsize\t"(_ "Volume logical size")" (SIZE)"

    # Autogenerate userquota@$USER list; only usernames are supported by the completion, but the zfs command supports more formats
    for user in (__fish_print_users)
        set -l tabAndBefore (echo -e "userquota@$user\t")
        printf (_ "%sMax usage by user %s\n") $tabAndBefore $user
    end
    # Autogenerate groupquota@$USER list
    for group in (__fish_print_groups)
        set -l tabAndBefore (echo -e "groupquota@$group\t")
        printf (_ "%sMax usage by group %s\n") $tabAndBefore $group
    end
    if test $OS = "SunOS"
        echo -e "aclmode\t"(_ "How is ACL modified by chmod")" (discard, groupmask, passthrough, restricted)"
        echo -e "mlslabel\t"(_ "Can the dataset be mounted in a zone with Trusted Extensions enabled")" (LABEL, none)"
        echo -e "nbmand\t"(_ "Mount with Non Blocking mandatory locks")" (on, off)"
        echo -e "sharesmb\t"(_ "Share in Samba")" (on, off)"
        echo -e "shareiscsi\t"(_ "Share as an iSCSI target")" (on, off)"
        echo -e "version\t"(_ "On-disk version of filesystem")" (1, 2, current)"
        echo -e "vscan\t"(_ "Scan regular files for viruses on opening and closing")" (on, off)"
        echo -e "xattr\t"(_ "Extended attributes")" (on, off, sa)"
        echo -e "zoned\t"(_ "Managed from a non-global zone")" (on, off)"
    else if test $OS = "Linux"
        echo -e "acltype\t"(_ "Use no ACL or POSIX ACL")" (noacl, posixacl)"
        echo -e "nbmand\t"(_ "Mount with Non Blocking mandatory locks")" (on, off)"
        echo -e "relatime\t"(_ "Sometimes update access time on read")" (on, off)"
        echo -e "shareiscsi\t"(_ "Share as an iSCSI target")" (on, off)"
        echo -e "sharesmb\t"(_ "Share in Samba")" (on, off)"
        echo -e "snapdev\t"(_ "Hide volume snapshots")" (hidden, visible)"
        echo -e "version\t"(_ "On-disk version of filesystem")" (1, 2, current)"
        echo -e "vscan\t"(_ "Scan regular files for viruses on opening and closing")" (on, off)"
        echo -e "xattr\t"(_ "Extended attributes")" (on, off, sa)"
    else if test $OS = "FreeBSD"
        echo -e "aclmode\t"(_ "How is ACL modified by chmod")" (discard, groupmask, passthrough, restricted)"
        echo -e "volmode\t"(_ "How to expose volumes to OS")" (default, geom, dev, none)"
    end
    # User properties; the /dev/null redirection masks the possible "no datasets available"
    zfs list -o all 2>/dev/null | head -n 1 | string replace -a -r "\s+" "\n" | string match -e ":" | string lower
end