`rclone genautocomplete bash` vs. `rclone completion bash` : neither works fully

What is the problem you are having with rclone?

  • If I use rclone genautocomplete bash I can get bash completion of remote drives, but not bash completion of rclone commands e.g. rclone bisync
    (see end of Tab-completion for remote paths · Issue #1529 · rclone/rclone · GitHub)
  • If I use rclone completion bash I can get bash completion of rclone commands (in this case rclone bisync, but others too), but not bash completion of remotes.
  • By default, both write to file /etc/bash_completion.d/rclone (for one of them the default is to stdout but it is suggested in the docs to write to that file).
  • I have found a way round by writing one to the above file, and one to a file within my home directory, which I then source.
  • So the question/s are:
  • These commands sound very similar...are they duplicates?
  • Based on my experience, it seems like these commands should be "added together". (a better temporary solution than writing two separate files might be to copy and paste the output of the one that writes to stdout into the default file)

Run the command 'rclone version' and share the full output of the command.

rclone v1.62.2

  • os/version: debian bookworm/sid (64 bit)
  • os/kernel: 6.2.6-76060206-generic (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.20.2
  • go/linking: static
  • go/tags: none

Which cloud storage system are you using? (eg Google Drive)

onedrive for business

The command you were trying to run (eg rclone copy /tmp remote:tmp)

(see above)

A log from the command with the -vv flag

This is bash completion, cannot run with -vv flag

That is a very good point. I think rclone completion is being added automatically by the command line parsing library we use (this is new behaviour) and rclone genautocomplete is the one we wrote specially.

So there are two issues here!

  1. rclone genautocomplete not working properly
  2. rclone completions existing at all!

rclone genautocomplete should be all you need. I certainly have completion on rclone commands but then I haven't updated the completion script since October 2022...

Let me try the v1.62.2 completion script.

That seems to work fine - I get completion for

  • sub commands, eg rclone co<TAB>
  • flags, eg rclone copy --s3-list-<TAB>
  • paths eg rclone copy s3:rcl<TAB>

I'm using

$ bash --version
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)


$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.2 LTS
Release:	22.04
Codename:	jammy

How about you? Are you using bash as a shell? If so which version?

I'm using

$ bash --version 
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)


No LSB modules are available.
Distributor ID:	Pop
Description:	Pop!_OS 22.04 LTS
Release:	22.04
Codename:	jammy

Thank you for the advice.

  • On inspecting /etc/bash_completion I found it simply sources /usr/share/bash-completion/bash_completion.
  • This is a long file...but there is also a sub-directory within the same directory called completions which I presume it uses, and I found many files in there including a file for rclone. This is likely for the rclone installed using my package manager (but it's old so I did the suggested steps to install a newer version). Therefore, I decided to overwrite it using rclone genautocomplete bash /usr/share/bash-completion/completions/rclone.
  • This resulted in the same as before, bash-completion of remotes, but not commands (bisync and others)
  • I actually have a different computer in which I wanted to do the same thing (same OS as above), but on this one I did the script installation instead of downloading a Precompiled binary (the system in previous bullet points...which I then put a soft link into ${HOME}/bin which is on the PATH). On this system, I did the ordinary rclone genautocomplete bash (or I might have overwritten /usr/share/bash-completion/completions/rclone, I can't remember (check!) ) and this worked!
  • (refer to check!) I overwrote /usr/share/bash-completion/completions/rclone...this suggests there's a discrepancy between using rclone via downloading precompiled binary (into home directory, then run from /home/<username>/bin/) vs. using the rclone script install which I am pretty sure overwrites /usr/bin/rclone, in terms of using the bash-completion script.


Hmm, yes. Rclone will normally install completion scripts in to the user part not the system part.

I'm not sure I want to change this, but thanks for the note.

I've fixed there being two completion commands - thanks for bringing that to my attention :slight_smile:

  • Script installation : sometimes apt will think it has still installed rclone, even though I did a script installation which overwrote /usr/bin/rclone. I therefore thought it would make sense to do sudo apt remove rclone, and then do the script installation of rclone again. This in fact worked completely in terms of bash completion (of both commands and remotes), and I didn't even need to run sudo rclone genautocomplete bash.

In summary, I found:

sudo apt remove rclone
sudo -v ; curl https://rclone.org/install.sh | sudo bash

works completely in terms of bash completion. Just doing the script install without first removing rclone via apt causes an issue with bash completion which you can rectify by doing rclone genautocomplete bash.
Downloading the rclone binary into home directory has issues with bash completion, even after doing rclone genautocomplete bash.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.