You are not logged in.

#1 2010-10-02 21:05:14

SanskritFritz
Member
From: Budapest, Hungary
Registered: 2009-01-08
Posts: 1,924
Website

Post your fish-shell tab completion scripts here

Fish shell is not really active nowadays, tab completion scripts are aging and many are missing. Let's fill the gap by collecting our autocompletion scripts here. I start first with a patch to pacman.fish:

55c55
< complete -c pacman -n '__fish_contains_opt -s A -s F -s U' -a '(__fish_complete_suffix pkg.tar.gz)' -d 'Local package'
---
> complete -c pacman -n '__fish_contains_opt -s A -s F -s U' -a '(__fish_complete_suffix pkg.tar.xz)' -d 'Local package'

and here is bauerbill.fish:

# Completions for bauerbill, using short options when possible
# Based on Giorgio Lando's pacman.fish

# Primary operations
complete -c bauerbill -s A -f -n '__fish_not_contain_opt -s F -s U -s Q -s R -s S -s h' -d 'Add a package to the system'
complete -c bauerbill -s F -f -n '__fish_not_contain_opt -s A -s U -s Q -s R -s S -s h' -d 'Upgrade a package which is already in the system'
complete -c bauerbill -s U -f -n '__fish_not_contain_opt -s A -s F -s Q -s R -s S -s h' -d 'Upgrade or add a package in the system'
complete -c bauerbill -s Q -f -n '__fish_not_contain_opt -s A -s F -s U -s R -s S -s h' -d 'Query the package database'
complete -c bauerbill -s R -f -n '__fish_not_contain_opt -s A -s F -s U -s Q -s S -s h' -d 'Remove packages from the system'
complete -c bauerbill -s S -f -n '__fish_not_contain_opt -s A -s F -s U -s Q -s R -s h' -d 'Synchronize packages'
complete -c bauerbill -o V -f -d 'Display version and exit'

# General options
complete -c bauerbill -n '__fish_contains_opt -s A -s F -s Q -s R -s S -s U' -s d -d 'Skips all dependency checks'
complete -c bauerbill -n '__fish_contains_opt -s A -s F -s Q -s R -s S -s U' -s f -d 'Bypass file conflict checks'
complete -c bauerbill -n '__fish_contains_opt -s A -s F -s Q -s R -s S -s U' -s r -d 'Specify an alternative installation root'
complete -c bauerbill -n '__fish_contains_opt -s A -s F -s Q -s R -s S -s U' -s v -d 'Output more status messages'
complete -c bauerbill -n '__fish_contains_opt -s A -s F -s Q -s R -s S -s U' -l config -d 'Specify an altenate config file'
complete -c bauerbill -n '__fish_contains_opt -s A -s F -s Q -s R -s S -s U' -l noconfirm -d 'Bypass any question'
complete -c bauerbill -s h -f -d 'Display syntax and help for the operation'

# Query options
complete -c bauerbill -n '__fish_contains_opt -s Q' -s c -d 'View the changelog of a package'
complete -c bauerbill -n '__fish_contains_opt -s Q' -s g -d 'Display all packages in the group'
complete -c bauerbill -n '__fish_contains_opt -s Q' -s o -d 'Search for the package that owns file'
complete -c bauerbill -n '__fish_contains_opt -s Q' -s e -d 'List orphan packages'
complete -c bauerbill -n '__fish_contains_opt -s Q' -s m -d 'List all packages which are not in the sync database'
complete -c bauerbill -n '__fish_contains_opt -s Q' -s u -d 'List all out of date packages in the system'
complete -c bauerbill -n '__fish_contains_opt -s Q' -s s -d 'Search each locally installed package for regexp'
complete -c bauerbill -n '__fish_contains_opt -s Q' -s i -d 'Display information on a given package'
complete -c bauerbill -n '__fish_contains_opt -s Q' -s l -d 'List all files owned by a given package'
complete -c bauerbill -n '__fish_contains_opt -s Q' -s p -d 'Apply the query to a package file and not to an installed package'

# Remove options
complete -c bauerbill -n '__fish_contains_opt -s R' -s c -d 'Remove also the packages that depends on the target packages'
complete -c bauerbill -n '__fish_contains_opt -s R' -s k -d 'Remove the database entries only'
complete -c bauerbill -n '__fish_contains_opt -s R' -s n -d 'Ignore file backup designations'
complete -c bauerbill -n '__fish_contains_opt -s R' -s s -d 'Remove also the dependencies of the target packages'

# Sync options
complete -c bauerbill -n '__fish_contains_opt -s S' -s c -d 'Remove old packages from the cache; if iterated, remove all the packages from the cache'
complete -c bauerbill -n '__fish_contains_opt -s S' -s e -d 'Install only the dependencies of the target packages'
complete -c bauerbill -n '__fish_contains_opt -s S' -s g -d 'Display all packages in the group'
complete -c bauerbill -n '__fish_contains_opt -s S' -s i -d 'Display informations for the target package'
complete -c bauerbill -n '__fish_contains_opt -s S' -s l -d 'List all packages in the repository'
complete -c bauerbill -n '__fish_contains_opt -s S' -s p -d 'Display URIs for target packages and dependencies'
complete -c bauerbill -n '__fish_contains_opt -s S' -s s -d 'Search packages and descriptions in the repos for regexp'
complete -c bauerbill -n '__fish_contains_opt -s S' -s u -d 'Upgrade all packages that are out of date'
complete -c bauerbill -n '__fish_contains_opt -s S' -s w -d 'Only download the target packages'
complete -c bauerbill -n '__fish_contains_opt -s S' -s y -d 'Download a fresh copy of the master package list from the servers'
complete -c bauerbill -n '__fish_contains_opt -s S' -l ignore -d 'Ignore upgrades of the target packages'
complete -c bauerbill -n '__fish_contains_opt -s S' -l noprogressbar -d 'Do not show a progressbar when downloading files'

# Complete with local packages
complete -c bauerbill -n '__fish_contains_opt -s A -s F -s U' -a '(__fish_complete_suffix pkg.tar.xz)' -d 'Local package'
# Complete with installed packages
complete -c bauerbill -n '__fish_contains_opt -s Q -s R' -a '(pacman -Q | cut --delim " " --fields 1)' -d 'Installed package'
# Complete with packages in the repos
complete -c bauerbill -n '__fish_contains_opt -s S' -a '(pacman -Sl | cut --delim " " --fields 2 | sort)' -d 'Repo package'

# Bauerbill specific switches
complete --command bauerbill --condition '__fish_not_contain_opt aur' --long-option aur --description 'Compile package using the Arch User Repository'
complete --command bauerbill --condition '__fish_not_contain_opt abs' --long-option abs --description 'Recompile package using the Arch Build System'

zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)

Offline

#2 2010-10-03 15:08:41

SanskritFritz
Member
From: Budapest, Hungary
Registered: 2009-01-08
Posts: 1,924
Website

Re: Post your fish-shell tab completion scripts here

A patch for makepkg.fish:

20a21
> complete -c makepkg -f -l source -d 'Build a source-only tarball for AUR upload'

zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)

Offline

#3 2010-10-14 11:51:04

SanskritFritz
Member
From: Budapest, Hungary
Registered: 2009-01-08
Posts: 1,924
Website

Re: Post your fish-shell tab completion scripts here

Here are some useful completions: http://github.com/zmalltalker/fish-nuggets


zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)

Offline

#4 2010-10-14 12:56:36

SanskritFritz
Member
From: Budapest, Hungary
Registered: 2009-01-08
Posts: 1,924
Website

Re: Post your fish-shell tab completion scripts here

A quick'n dirty ln.fish (how come this is missing from the default fish install?):

# Completions for ln
# Author: SanskritFritz (gmail)

complete -c ln -f -s s -l symbolic                   -d 'make symbolic links instead of hard links'
complete -c ln -f      -l backup=CONTROL             -d 'make a backup of each existing destination file'
complete -c ln -f -s b                               -d 'like --backup but does not accept an argument'
complete -c ln -f -s d -l directory                  -d 'allow  the  superuser to attempt to hard link directories'
complete -c ln -f -s f -l force                      -d 'remove existing destination files'
complete -c ln -f -s i -l interactive                -d 'prompt whether to remove destinations'
complete -c ln -f -s L -l logical                    -d 'make hard links to symbolic link references'
complete -c ln -f -s n -l no-dereference             -d 'treat destination that is a symlink to a directory as if it were a normal file'
complete -c ln -f -s P -l physical                   -d 'make hard links directly to symbolic links'
complete -c ln -f -s S -l suffix=SUFFIX              -d 'override the usual backup suffix'
complete -c ln -f -s t -l target-directory=DIRECTORY -d 'specify the DIRECTORY in which to create the links'
complete -c ln -f -s T -l no-target-directory        -d 'treat LINK_NAME as a normal file'
complete -c ln -f -s v -l verbose                    -d 'print name of each linked file'
complete -c ln -f      -l help                       -d 'display this help and exit'
complete -c ln -f      -l version                    -d 'output version information and exit'

zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)

Offline

#5 2010-10-30 11:32:41

SanskritFritz
Member
From: Budapest, Hungary
Registered: 2009-01-08
Posts: 1,924
Website

Re: Post your fish-shell tab completion scripts here

Fix for locate.fish

15c15
< complete -c locate -s b -l base-name --description 'Match against the final component of the file name'
---
> complete -c locate -s b -l basename --description 'Match against the final component of the file name'

zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)

Offline

#6 2010-11-08 13:48:37

SanskritFritz
Member
From: Budapest, Hungary
Registered: 2009-01-08
Posts: 1,924
Website

Re: Post your fish-shell tab completion scripts here

shoutcast-search.fish

# Completions for shoutcast-search
# Author: SanskritFritz (gmail)
complete -c shoutcast-search -f      -l version     -d 'Show program\'s version number and exit'
complete -c shoutcast-search -f -s h -l help        -d 'Show program\'s help message and exit'
complete -c shoutcast-search -f      -l list-genres -d 'List available genres from shoutcast.com and exit'
complete -c shoutcast-search -f -s n -l limit       -d 'Set maximum =NUMBER of stations to be listed'
complete -c shoutcast-search -f -s r -l random      -d 'Sort stations randomly instead of by number of listeners'
complete -c shoutcast-search -f -s v -l verbose     -d 'Verbose output, useful for getting search right'
complete -c shoutcast-search -f -s f -l format      -d 'String describing the =FORMAT for the found stations'
complete -c shoutcast-search -f -s g -l genre       -d 'Search for stations with =GENRE in their listed genre'
complete -c shoutcast-search -f -s p -l playing     -d 'Search for stations with =PLAYING in their current track'
complete -c shoutcast-search -f -s s -l station     -d 'Search for stations with =STATION in their name'
complete -c shoutcast-search -f -s b -l bitrate     -d 'Filter stations matching with the =BITRATE expression'
complete -c shoutcast-search -f -s l -l listeners   -d 'Filter stations with the number of current =LISTENERS'
complete -c shoutcast-search -f -s t -l type        -d 'Filter stations based on the codec (=mpeg|=aacp)'

zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)

Offline

#7 2010-11-10 23:01:57

SanskritFritz
Member
From: Budapest, Hungary
Registered: 2009-01-08
Posts: 1,924
Website

Re: Post your fish-shell tab completion scripts here

duply.fish

# Completions for duply
# Author: SanskritFritz (gmail)

# First parameter is the profile name, or 'usage'
complete --command duply --no-files --condition '__fish_is_first_token' --arguments '(/bin/ls /etc/duply ^/dev/null) (/bin/ls ~/.duply ^/dev/null)' --description 'Profile'
complete --command duply --no-files --arguments 'usage' --description 'Get usage help text'

# Second parameter is a duply command
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'create'     --description 'Creates a configuration profile'
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'backup'     --description 'Backup with pre/post script execution'
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'bkp'        --description 'Backup without executing pre/post scripts'
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'pre'        --description 'Execute <profile>/pre script'
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'post'       --description 'Execute <profile>/post script'
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'full'       --description 'Force full backup'
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'incr'       --description 'Force incremental backup'
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'list'       --description 'List all files in backup (as it was at <age>, default: now)'
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'status'     --description 'Prints backup sets and chains currently in repository'
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'verify'     --description 'List files changed since latest backup'
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'purge'      --description 'Shows outdated backup archives [--force, delete these files]'
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'purge-full' --description 'Shows outdated backups [--force, delete these files]'
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'cleanup'    --description 'Shows broken backup archives [--force, delete these files]'
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'restore'    --description 'Restore the backup to <target_path> [as it was at <age>]'
complete --command duply --no-files --condition 'not __fish_is_first_token' --arguments 'fetch'      --description 'Restore single file/folder from backup [as it was at <age>]'

# Options
complete --command duply --no-files --long-option force   --description 'Really execute the commands: purge, purge-full, cleanup'
complete --command duply --no-files --long-option preview --description 'Do nothing but print out generated duplicity command lines'
complete --command duply --no-files --long-option dry-run --description 'Calculate what would be done, but do not perform any backend actions'

zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)

Offline

#8 2010-11-17 22:40:11

SanskritFritz
Member
From: Budapest, Hungary
Registered: 2009-01-08
Posts: 1,924
Website

Re: Post your fish-shell tab completion scripts here

Well, I looked a bit more after fish development. Asking on the irc channel I learned that the original developer left the project without warning. The remaining team forked (or rather relocated) the project onto gitorius, and several bug fixes are already committed. On the mailing list I have learned that the head branch is considered stable for everyday use. So I created the fish-git package in the AUR. Doing this I discovered a handy python script which is not included into the official package: make_completions.py. This brilliant script takes a man page and tries (pretty successfully I might add) to create a completion script for that particular command, which can serve as a basic skeleton for a completion script. Amazing.


zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)

Offline

#9 2010-11-23 16:02:49

SanskritFritz
Member
From: Budapest, Hungary
Registered: 2009-01-08
Posts: 1,924
Website

Re: Post your fish-shell tab completion scripts here

I transferred the contents of this thread to the wiki. From now on, I will contribute there, it fits better to a wiki than a forum.


zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)

Offline

#10 2010-11-23 17:10:50

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: Post your fish-shell tab completion scripts here

Thanks for all your work and efforts.


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#11 2010-11-23 20:23:17

SanskritFritz
Member
From: Budapest, Hungary
Registered: 2009-01-08
Posts: 1,924
Website

Re: Post your fish-shell tab completion scripts here

Thanks for the kind words, they keep us going smile


zʇıɹɟʇıɹʞsuɐs AUR || Cycling in Budapest with a helmet camera || Revised log levels proposal: "FYI" "WTF" and "OMG" (John Barnette)

Offline

Board footer

Powered by FluxBB