Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add completion for fishshell #440

Merged
merged 9 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions completions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Shell completion scripts

By default, rmw completions are copied to the rmw documentation dir when rmw
is installed. If they aren't present on your system, you can install a shell
completion manually by getting the completion from the source package or git
repository. See the links below for specific installation instructions for
each completion.

## Fish

[Where to put completions](https://fishshell.com/docs/current/completions.html#where-to-put-completions)
31 changes: 31 additions & 0 deletions completions/fish/rmw.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This file contains the fish completion for rmw
#
# rmw is a trashcan/recycle bin utility for the command line
#
# More information about this tool on https://github.com/theimpossibleastronaut/rmw
#
# This file is intended to be released with rmw with various packaging managers

complete rmw -s h -l help -d 'show help for command line options' -f
complete rmw -s c -l config -d 'use an alternate configuration' -r
complete rmw -s l -l list -d 'list waste directories' -f
complete rmw -s g -l purge -d 'purge expired files'
complete rmw -s o -l orphaned -d 'check for orphaned files (maintenance)' -f
complete rmw -s f -l force -d 'allow purging of expired files' -f
complete rmw -l empty -d 'completely empty (purge) all waste directories' -f
complete rmw -l top-level-bypass -d 'bypass protection of top-level files'

complete rmw -s v -l verbose -d 'increase output messages' -f
complete rmw -l warranty -d 'display warranty' -f
complete rmw -l version -d 'display version and license information' -f

complete rmw -s z -l restore -d 'restore FILE(s) (see man page example)'
complete rmw -s s -l select -d 'select files from list to restore' -f
complete rmw -s u -l undo-last -d 'undo last move' -f
complete rmw -s m -l most-recent-list -d "list most recently rmw'ed files" -f

# Options kept for compatibility purpose that do not need to be completed
# they are listed here to avoid people wondering why they are missing
# complete rmw -s R -s r -l recursive -d 'kept for compatibility purpose with rm (recursive operation is enabled by default)'
# complete rmw -s i -l interactive -d 'Prompt for removal (not implemented)'

7 changes: 7 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,10 @@ install_data(
),
install_dir : get_option('docdir')
)

# Copy completions to docdir
install_subdir(
'completions',
install_dir : join_paths(get_option('docdir')),
strip_directory : false
)
4 changes: 4 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ option('docdir', type : 'string', value : 'share/doc/rmw',

option('without-curses', type : 'boolean', value : 'false',
description : 'build without curses/menu support')

option('install_shell_completions', type: 'boolean', value: true,
description: 'Install shell completions')