Fish Tab Auto-completions (#991)

* Created the set of auto-completes that Bash returns with '-<tab>' and '--<tab>'.  Made sure that --synchronize and -m/--monitor can't be used together based on the "#exclude some mutually exclusive options" in complete.bash file.
* Add fish variables and checks to configure (mirroring zsh).
* Add the FISH_COMPLETION_DIR variables and the install and remove instructions for the onedrive.fish completions file.
This commit is contained in:
Brandon Goddard 2020-07-08 23:05:48 -07:00 committed by GitHub
parent 25fd9a1b00
commit 2b7e36d57f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 1 deletions

View file

@ -28,6 +28,7 @@ notify_LIBS = @notify_LIBS@
COMPLETIONS = @COMPLETIONS@
BASH_COMPLETION_DIR = @BASH_COMPLETION_DIR@
ZSH_COMPLETION_DIR = @ZSH_COMPLETION_DIR@
FISH_COMPLETION_DIR = @FISH_COMPLETION_DIR@
DEBUG = @DEBUG@
DC = @DC@
@ -127,6 +128,7 @@ endif
ifeq ($(COMPLETIONS),yes)
$(INSTALL) -D -m 644 contrib/completions/complete.zsh $(DESTDIR)$(ZSH_COMPLETION_DIR)/_onedrive
$(INSTALL) -D -m 644 contrib/completions/complete.bash $(DESTDIR)$(BASH_COMPLETION_DIR)/onedrive
$(INSTALL) -D -m 644 contrib/completions/complete.fish $(DESTDIR)$(FISH_COMPLETION_DIR)/onedrive.fish
endif
@ -151,6 +153,7 @@ endif
ifeq ($(COMPLETIONS),yes)
rm -f $(DESTDIR)$(ZSH_COMPLETION_DIR)/_onedrive
rm -f $(DESTDIR)$(BASH_COMPLETION_DIR)/onedrive
rm -f $(DESTDIR)$(FISH_COMPLETION_DIR)/onedrive.fish
endif

22
configure vendored
View file

@ -590,6 +590,7 @@ LIBOBJS
DEBUG
ZSH_COMPLETION_DIR
BASH_COMPLETION_DIR
FISH_COMPLETION_DIR
bashcompdir
COMPLETIONS
NOTIFICATIONS
@ -660,6 +661,7 @@ enable_notifications
enable_completions
with_bash_completion_dir
with_zsh_completion_dir
with_fish_completion_dir
enable_debug
'
ac_precious_vars='build_alias
@ -1289,7 +1291,7 @@ Optional Features:
--disable-version-check Disable checks of compiler version during configure
time
--enable-notifications Enable desktop notifications via libnotify
--enable-completions Install shell completions for bash and zsh
--enable-completions Install shell completions for bash, zsh, and fish
--enable-debug Pass debug option to the compiler
Optional Packages:
@ -1303,6 +1305,8 @@ Optional Packages:
Directory for bash completion files
--with-zsh-completion-dir=DIR
Directory for zsh completion files
--with-fish-completion-dir=DIR
Directory for fish completion files
Some influential environment variables:
DC D compiler executable
@ -2579,6 +2583,22 @@ fi
ZSH_COMPLETION_DIR=$with_zsh_completion_dir
# Check whether --with-fish-completion-dir was given.
if test "${with_fish_completion_dir+set}" = set; then :
withval=$with_fish_completion_dir;
else
with_fish_completion_dir=auto
fi
if test "x$with_fish_completion_dir" = "xyes" -o "x$with_fish_completion_dir" = "xauto"; then :
with_fish_completion_dir="/usr/share/fish/completions"
fi
FISH_COMPLETION_DIR=$with_fish_completion_dir
fi
# Check whether --enable-debug was given.

View file

@ -0,0 +1,35 @@
# FISH completions for OneDrive Linux Client
# License: GPLv3+ (as with the rest of the OneDrive Linux client project)
complete -c onedrive -f
complete -c onedrive -l check-for-nomount -d 'Check for the presence of .nosync in the syncdir root. If found, do not perform sync.'
complete -c onedrive -l check-for-nosync -d 'Check for the presence of .nosync in each directory. If found, skip directory from sync.'
complete -c onedrive -l create-directory -d 'Create a directory on OneDrive - no sync will be performed.'
complete -c onedrive -l debug-https -d 'Debug OneDrive HTTPS communication.'
complete -c onedrive -l disable-notifications -d 'Do not use desktop notifications in monitor mode.'
complete -c onedrive -l disable-upload-validation -d 'Disable upload validation when uploading to OneDrive.'
complete -c onedrive -l display-config -d 'Display what options the client will use as currently configured - no sync will be performed.'
complete -c onedrive -l display-sync-status -d 'Display the sync status of the client - no sync will be performed.'
complete -c onedrive -l download-only -d 'Only download remote changes.'
complete -c onedrive -l dry-run -d 'Perform a trial sync with no changes made.'
complete -c onedrive -l enable-logging -d 'Enable client activity to a separate log file.'
complete -c onedrive -l force-http-1.1 -d 'Force the use of HTTP 1.1 for all operations.'
complete -c onedrive -l force-http-2 -d 'Force the use of HTTP 2 for all operations.'
complete -c onedrive -l get-O365-drive-id -d 'Query and return the Office 365 Drive ID for a given Office 365 SharePoint Shared Library.'
complete -c onedrive -s h -l help -d 'Print help information.'
complete -c onedrive -l local-first -d 'Synchronize from the local directory source first, before downloading changes from OneDrive.'
complete -c onedrive -l logout -d 'Logout the current user.'
complete -c onedrive -n "not __fish_seen_subcommand_from --synchronize" -a "-m --monitor" -d 'Keep monitoring for local and remote changes.'
complete -c onedrive -l no-remote-delete -d 'Do not delete local file deletes from OneDrive when using --upload-only.'
complete -c onedrive -l print-token -d 'Print the access token, useful for debugging.'
complete -c onedrive -l remote-directory -d 'Remove a directory on OneDrive - no sync will be performed.'
complete -c onedrive -l resync -d 'Forget the last saved state, perform a full sync.'
complete -c onedrive -l single-directory -d 'Specify a single local directory within the OneDrive root to sync.'
complete -c onedrive -l skip-dot-files -d 'Skip dot files and folders from syncing.'
complete -c onedrive -l skip-symlinks -d 'Skip syncing of symlinks.'
complete -c onedrive -l source-directory -d 'Source directory to rename or move on OneDrive - no sync will be performed.'
complete -c onedrive -n "not __fish_seen_subcommand_from --monitor; and not __fish_seen_subcommand_from -m" -l synchronize -d 'Perform a synchronization.'
complete -c onedrive -l upload-only -d 'Only upload to OneDrive, do not sync changes from OneDrive locally'
complete -c onedrive -s v -l verbose -d 'Print more details, useful for debugging (repeat for extra debugging).'
complete -c onedrive -l version -d 'Print the version and exit.'