Fish completions

This commit is contained in:
Benjamin Sago 2017-05-06 20:34:59 +01:00
parent 32ab6a5823
commit 3c7800c124
2 changed files with 81 additions and 2 deletions

21
Vagrantfile vendored
View File

@ -18,8 +18,11 @@ Vagrant.configure(2) do |config|
# Install the dependencies needed for exa to build, as quietly as
# apt can do.
config.vm.provision :shell, privileged: true, inline:
%[apt-get install -qq -o=Dpkg::Use-Pty=0 -y git cmake libgit2-dev curl attr pkg-config]
config.vm.provision :shell, privileged: true, inline: <<-EOF
apt-get install -qq -o=Dpkg::Use-Pty=0 -y \
git cmake curl attr pkg-config libgit2-dev \
fish
EOF
# Guarantee that the timezone is UTC -- some of the tests
@ -45,6 +48,13 @@ Vagrant.configure(2) do |config|
grep -q -F "$2" $1 || echo "$2" >> $1
}
put_line ~/.bashrc 'export CARGO_TARGET_DIR=/home/#{developer}/target'
EOF
# Create "dexa" and "rexa" scripts that run the debug and release
# compiled versions of exa.
config.vm.provision :shell, privileged: true, inline: <<-EOF
echo -e "#!/bin/sh\necho \"Use 'dexa' for debug exa, or 'rexa' for release exa\"" > /usr/bin/exa
echo -e "#!/bin/sh\n/home/#{developer}/target/debug/exa" > /usr/bin/dexa
echo -e "#!/bin/sh\n/home/#{developer}/target/release/exa" > /usr/bin/rexa
@ -52,6 +62,13 @@ Vagrant.configure(2) do |config|
EOF
# Link the completion files so theyre “installed”.
config.vm.provision :shell, privileged: true, inline: <<-EOF
test -f /usr/share/fish/completions/exa.fish \
|| ln -s /vagrant/contrib/completions.fish /usr/share/fish/completions/exa.fish
EOF
# We create two users that own the test files.
# The first one just owns the ordinary ones, because we dont want the
# test outputs to depend on “vagrant” or “ubuntu” existing.

62
contrib/completions.fish Normal file
View File

@ -0,0 +1,62 @@
# Meta-stuff
complete -c exa -s 'v' -l 'version' -d "Show version of exa"
complete -c exa -s '?' -l 'help' -d "Show list of command-line options"
# Display options
complete -c exa -s '1' -l 'oneline' -d "Display one entry per line"
complete -c exa -s 'G' -l 'grid' -d "Display entries in a grid"
complete -c exa -s 'l' -l 'long' -d "Display extended details and attributes"
complete -c exa -s 'R' -l 'recurse' -d "Recurse into directories"
complete -c exa -s 'T' -l 'tree' -d "Recurse into directories as a tree"
complete -c exa -s 'x' -l 'across' -d "Sort multi-column view entries accross"
complete -c exa -s 'F' -l 'classify' -d "Display type indicator by file names"
complete -c exa -l 'color' -d "When to use terminal colours"
complete -c exa -l 'colour' -d "When to use terminal colours"
complete -c exa -l 'color-scale' -d "Highlight levels of file sizes distinctly"
complete -c exa -l 'colour-scale' -d "Highlight levels of file sizes distinctly"
# Filtering and sorting options
complete -c exa -l 'group-directories-first' -d "Sort directories before other files"
complete -c exa -s 'a' -l 'all' -d "Don't hide hidden and 'dot' files"
complete -c exa -s 'd' -l 'list-dirs' -d "List directories like regular files"
complete -c exa -s 'r' -l 'reverse' -d "Reverse the sort order"
complete -c exa -s 's' -l 'sort' -x -d "Which field to sort by" -a "
accessed\t'Sort by file accessed time'
created\t'Sort by file modified time'
ext\t'Sort by file extension'
Ext\t'Sort by file extension (case-insensitive)'
extension\t'Sort by file extension'
Extension\t'Sort by file extension (case-insensitive)'
filename\t'Sort by filename'
Filename\t'Sort by filename (case-insensitive)'
inode\t'Sort by file inode'
modified\t'Sort by file modified time'
name\t'Sort by filename'
Name\t'Sort by filename (case-insensitive)'
none\t'Do not sort files at all'
size\t'Sort by file size'
"
complete -c exa -s 'I' -l 'ignore-glob' -d "Ignore files that match these glob patterns" -r
# Long view options
complete -c exa -s 'b' -l 'binary' -d "Display file sizes with binary prefixes"
complete -c exa -s 'B' -l 'bytes' -d "Display file sizes in bytes, without any prefixes"
complete -c exa -s 'g' -l 'group' -d "Show each file's group"
complete -c exa -s 'h' -l 'header' -d "Add a header row to each column"
complete -c exa -s 'h' -l 'links' -d "Show each file's number of hard links"
complete -c exa -s 'g' -l 'group' -d "Show each file's inode number"
complete -c exa -s 'L' -l 'level' -d "Limit the depth of recursion" -a "1 2 3 4 5 6 7 8 9"
complete -c exa -s 'm' -l 'modified' -d "Use the modified timestamp field"
complete -c exa -s 'S' -l 'blocks' -d "Show each file's number of filesystem blocks"
complete -c exa -s 't' -l 'time' -x -d "Which time field to show" -a "
accessed\t'Display accessed time'
created\t'Display created time'
modified\t'Display modified time'
"
complete -c exa -s 'u' -l 'accessed' -d "Use the accessed timestamp field"
complete -c exa -s 'U' -l 'created' -d "Use the created timestamp field"
# Optional extras
complete -c exa -s 'g' -l 'git' -d "Show the group column"
complete -c exa -s '@' -l 'extended' -d "Show each file's extended attributes and sizes"