diff --git a/contrib/completions/complete.bash b/contrib/completions/complete.bash index 5373c315..35808464 100644 --- a/contrib/completions/complete.bash +++ b/contrib/completions/complete.bash @@ -10,7 +10,7 @@ _onedrive() cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - options='--check-for-nomount --check-for-nosync --debug-https --disable-notifications --display-config --display-sync-status --download-only --disable-upload-validation --dry-run --enable-logging --force-http-1.1 --force-http-2 --local-first --logout -m --monitor --no-remote-delete --print-token --reauth --resync --skip-dot-files --skip-symlinks --synchronize --upload-only -v --verbose --version -h --help' + options='--check-for-nomount --check-for-nosync --debug-https --disable-notifications --display-config --display-sync-status --download-only --disable-upload-validation --dry-run --enable-logging --force-http-1.1 --force-http-2 --get-file-link --local-first --logout -m --monitor --no-remote-delete --print-token --reauth --resync --skip-dot-files --skip-symlinks --synchronize --upload-only -v --verbose --version -h --help' argopts='--create-directory --get-O365-drive-id --operation-timeout --remove-directory --single-directory --source-directory' # Loop on the arguments to manage conflicting options @@ -19,12 +19,21 @@ _onedrive() [[ ${COMP_WORDS[i]} == '--synchronize' ]] && options=${options/--monitor} [[ ${COMP_WORDS[i]} == '--monitor' ]] && options=${options/--synchronize} done - + case "$prev" in --confdir|--syncdir) _filedir return 0 ;; + + --get-file-link) + if command -v sed &> /dev/null; then + pushd "$(onedrive --display-config | sed -n "/sync_dir/s/.*= //p")" &> /dev/null + _filedir + popd &> /dev/null + fi + return 0 + ;; --create-directory|--get-O365-drive-id|--operation-timeout|--remove-directory|--single-directory|--source-directory) return 0 ;; @@ -33,7 +42,7 @@ _onedrive() return 0 ;; esac - + # notreached return 0 } diff --git a/contrib/completions/complete.fish b/contrib/completions/complete.fish index 0bd6da41..7547574c 100644 --- a/contrib/completions/complete.fish +++ b/contrib/completions/complete.fish @@ -16,6 +16,7 @@ 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-file-link -d 'Display the file link of a synced file.' 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.' diff --git a/contrib/completions/complete.zsh b/contrib/completions/complete.zsh index 74561bdf..b03ea686 100644 --- a/contrib/completions/complete.zsh +++ b/contrib/completions/complete.zsh @@ -21,6 +21,7 @@ all_opts=( '--enable-logging[Enable client activity to a separate log file]' '--force-http-1.1[Force the use of HTTP 1.1 for all operations]' '--force-http-2[Force the use of HTTP 2 for all operations]' + '--get-file-link[Display the file link of a synced file.]:file name:' '--get-O365-drive-id[Query and return the Office 365 Drive ID for a given Office 365 SharePoint Shared Library]:' '--local-first[Synchronize from the local directory source first, before downloading changes from OneDrive.]' '--logout[Logout the current user]'