rclone/cmd
Florian Gamböck 3c4407442d cmd: fix completion of remotes
The previous behavior of the remotes completion was that only
alphanumeric characters were allowed in a remote name. This limitation
has been lifted somewhat by #2985, which also allowed an underscore.

With the new implementation introduced in this commit, the completion of
the remote name has been simplified: If there is no colon (":") in the
current word, then complete remote name. Otherwise, complete the path
inside the specified remote. This allows correct completion of all
remote names that are allowed by the config (including - and _).
Actually it matches much more than that, even remote names that are not
allowed by the config, but in such a case there already would be a wrong
identifier in the configuration file.

With this simpler string comparison, we can get rid of the regular
expression, which makes the completion multiple times faster. For a
sample benchmark, try the following:

     # Old way
     $ time bash -c 'for _ in {1..1000000}; do
         [[ remote:path =~ ^[[:alnum:]]*$ ]]; done'

     real    0m15,637s
     user    0m15,613s
     sys     0m0,024s

     # New way
     $ time bash -c 'for _ in {1..1000000}; do
         [[ remote:path != *:* ]]; done'

     real    0m1,324s
     user    0m1,304s
     sys     0m0,020s
2019-03-15 13:16:42 +00:00
..
about about: don't attempt retries 2018-04-18 21:09:54 +01:00
all rcd: implement new command just to serve the remote control API 2018-11-03 11:32:00 +00:00
authorize Break the fs package up into smaller parts. 2018-01-15 17:51:14 +00:00
cachestats Implement new backend config system 2018-07-16 21:20:47 +01:00
cat Break the fs package up into smaller parts. 2018-01-15 17:51:14 +00:00
check check: Add one-way argument 2018-05-31 09:42:16 +01:00
cleanup Break the fs package up into smaller parts. 2018-01-15 17:51:14 +00:00
cmount cmount: fix on Linux - only apply volname for Windows and macOS 2018-11-22 20:41:05 +00:00
config config: when using auto confirm make user interaction configurable 2019-01-18 14:46:26 +00:00
copy copy/sync/move: add --create-empty-src-dirs flag - fixes #2869 2019-03-10 11:56:38 +00:00
copyto copy/sync/move: add --create-empty-src-dirs flag - fixes #2869 2019-03-10 11:56:38 +00:00
copyurl copyurl: factor code into operations and write test 2018-11-04 20:42:57 +00:00
cryptcheck check: Add one-way argument 2018-05-31 09:42:16 +01:00
cryptdecode Implement new backend config system 2018-07-16 21:20:47 +01:00
dbhashsum Break the fs package up into smaller parts. 2018-01-15 17:51:14 +00:00
dedupe dedupe: Add dedupe largest functionality - fixes #2269 2018-04-26 16:21:07 +01:00
delete delete: clarify that it only deletes files not directories 2018-11-02 17:07:45 +00:00
deletefile build: fixup code formatting after goimports change 2018-10-13 22:47:12 +01:00
genautocomplete support for zsh auto-completion - #983 2017-08-31 16:21:28 +01:00
gendocs Regularize the command definition names 2016-12-03 09:08:40 +00:00
hashsum hashsum: make generic tool for any hash to produce md5sum like output 2018-04-20 21:02:37 +01:00
info info: improve allowed character testing 2019-02-09 18:23:47 +00:00
link jottacloud: add link sharing support 2018-09-08 09:38:57 +01:00
listremotes listremotes: remove -l short flag as it conflicts with the new global flag 2019-02-03 12:17:15 +00:00
ls lsd: Add -R flag and fix and update docs for all ls commands 2018-04-26 08:55:03 +01:00
lsd lsd: Add -R flag and fix and update docs for all ls commands 2018-04-26 08:55:03 +01:00
lsf lsf: add 'e' format to show encrypted names and 'o' for original IDs 2019-02-14 14:45:35 +00:00
lsjson lsjson: use exactly the correct number of decimal places in the seconds 2019-02-03 20:03:23 +00:00
lsl lsd: Add -R flag and fix and update docs for all ls commands 2018-04-26 08:55:03 +01:00
md5sum Break the fs package up into smaller parts. 2018-01-15 17:51:14 +00:00
memtest Break the fs package up into smaller parts. 2018-01-15 17:51:14 +00:00
mkdir cmd: make names of argument parsing functions more consistent 2018-05-07 20:39:52 +01:00
mount build: fix problems found with unconvert 2019-02-02 11:45:07 +00:00
mountlib mountlib: clip blocks returned to 32 bit number for Windows 32 bit - fixes #2934 2019-01-27 12:04:56 +00:00
move copy/sync/move: add --create-empty-src-dirs flag - fixes #2869 2019-03-10 11:56:38 +00:00
moveto copy/sync/move: add --create-empty-src-dirs flag - fixes #2869 2019-03-10 11:56:38 +00:00
ncdu ncdu: fix display corruption with Chinese characters - #2989 2019-02-27 09:55:28 +00:00
obscure config: factor Obscure and Reveal into its own package 2018-01-18 20:19:55 +00:00
purge cmd: make names of argument parsing functions more consistent 2018-05-07 20:39:52 +01:00
rc cmd/rc: add --user and --pass flags and interpret --rc-user, --rc-pass, --rc-addr 2018-11-04 20:42:57 +00:00
rcat rcat: remove --checksum flag from the docs as it is not usually effective 2018-06-14 16:15:54 +01:00
rcd fix typo in rcd docs 2019-01-29 14:37:58 +00:00
reveal Add reveal command 2018-08-07 20:51:50 +01:00
rmdir cmd: make names of argument parsing functions more consistent 2018-05-07 20:39:52 +01:00
rmdirs cmd: make names of argument parsing functions more consistent 2018-05-07 20:39:52 +01:00
serve dlna: add connection manager service description 2019-03-15 13:14:31 +00:00
settier cmd and fs: Added new command settier which performs storage tier changes on 2018-09-12 21:09:08 +01:00
sha1sum Break the fs package up into smaller parts. 2018-01-15 17:51:14 +00:00
size size: Add --json flag 2018-04-13 13:38:06 +01:00
sync copy/sync/move: add --create-empty-src-dirs flag - fixes #2869 2019-03-10 11:56:38 +00:00
touch build: fixup code formatting after goimports change 2018-10-13 22:47:12 +01:00
tree build: fixup code formatting after goimports change 2018-10-13 22:47:12 +01:00
version cmd/version: factor version number parsing routines into fs/version 2018-11-05 15:44:40 +00:00
cmd.go filter: reload filter when the options are set via the rc - fixes #3018 2019-03-10 13:09:44 +00:00
help.go cmd: fix completion of remotes 2019-03-15 13:16:42 +00:00
progress.go cmd: fix --progress crash under Windows Jenkins - fixes #2846 2018-12-22 18:05:13 +00:00
progress_other.go cmd: fix --progress crash under Windows Jenkins - fixes #2846 2018-12-22 18:05:13 +00:00
progress_windows.go cmd: fix --progress crash under Windows Jenkins - fixes #2846 2018-12-22 18:05:13 +00:00
siginfo_darwin.go cmd: add siginfo handler 2018-06-02 17:35:13 +01:00
siginfo_others.go cmd: add siginfo handler 2018-06-02 17:35:13 +01:00