File: file

package info (click to toggle)
yash 2.60-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,152 kB
  • sloc: ansic: 34,578; makefile: 851; sh: 808; sed: 16
file content (89 lines) | stat: -rw-r--r-- 3,614 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
# (C) 2010 magicant

# Completion script for the "file" command.
# Supports POSIX 2008, Fine Free File 5.04, SunOS 5.10, HP-UX 11i v3.

function completion/file {

        if "${WORDS[1]}" --help >/dev/null 2>&1; then
                typeset type=FFF
        else
                typeset type="$(uname 2>/dev/null)"
        fi
        case $type in
                (FFF) typeset long=true ;;
                (*)   typeset long= ;;
        esac

        typeset OPTIONS ARGOPT PREFIX
        OPTIONS=( #>#
        "h ${long:+--no-dereference}; don't follow symbolic links"
        "m: ${long:+--magic-file:}; specify magic files"
        ) #<#

        case $type in (FFF|SunOS|HP-UX)
                OPTIONS=("$OPTIONS" #>#
                "c ${long:+--checking-printout}; check the format of the magic file"
                "f: ${long:+--files-from:}; specify a file containing filenames to examine"
                ) #<#
        esac
        case $type in
        (FFF)
                OPTIONS=("$OPTIONS" #>#
                "0 --print0; separate output lines with null byte rather than newline"
                "b --brief; don't print the filename before each file type description"
                "C --compile; compile a magic file"
                "d --debug; print debugging messages"
                "e: --exclude:; specify a type of test to skip"
                "F: --separator:; specify a separator shown between filenames and file types"
                "i --mime; print mime types/encodings rather than human-readable results"
                "k --keep-going; print all matching file types"
                "L --dereference; follow symbolic links"
                "N --no-pad; don't align output"
                "n --no-buffer; don't buffer output"
                "p --preserve-date; restore the access time of examined files"
                "r --raw; don't escape unprintable characters"
                "s --special-files; read and examine non-regular files"
                "v --version; print version info"
                "z --uncompress; examine contents of compressed files"
                "--apple; print Apple creator/type"
                "--help"
                "--mime-type; print mime types only"
                "--mime-encoding; print mime encoding names only"
                ) #<#
                ;;
        (*) # POSIX options
                OPTIONS=("$OPTIONS" #>#
                "d; do position/context-sensitive default system tests"
                "i; don't examine the contents of regular files"
                "M:; specify a file containing position-sensitive tests"
                ) #<#
                ;;
        esac

        command -f completion//parseoptions ${long:+-es}
        case $ARGOPT in
        (-)
                command -f completion//completeoptions
                ;;
        (e|--exclude) #>>#
                complete -P "$PREFIX" -D "EMX application type" apptype
                complete -P "$PREFIX" -D "text encoding" encoding
                complete -P "$PREFIX" -D "text tokens" tokens
                complete -P "$PREFIX" -D "Compound Document Files details" cdf
                complete -P "$PREFIX" -D "contents of compressed files" compress
                complete -P "$PREFIX" -D "ELF file details" elf
                complete -P "$PREFIX" -D "magic file test" soft
                complete -P "$PREFIX" -D "contents of tar files" tar
                ;; #<<#
        (F|--separator)
                ;;
        (*)
                complete -P "$PREFIX" -f
                ;;
        esac

}


# vim: set ft=sh ts=8 sts=8 sw=8 et: