Make s3cmd completions compatible with python3 environment

It seems that under python3, s3cmd emits its output as a long list (like
ls -l) with or without the --long parameter to "s3cmd ls s3://...".

This patch includes only s3://* paths from that output as completions.
This commit is contained in:
Mahmoud Al-Qudsi 2017-09-14 13:39:12 -05:00
parent e7b0327e08
commit 7113cc33f1

View file

@ -9,7 +9,7 @@ function __s3cmd_is_valid_remote_path
end
# Completions to allow for autocomplete of remote paths
complete -c s3cmd -f -n "__s3cmd_is_valid_remote_path" -a "(s3cmd ls (commandline -ct) 2>/dev/null)"
complete -c s3cmd -f -n "__s3cmd_is_valid_remote_path" -a "(s3cmd ls (commandline -ct) 2>/dev/null | string match -r -- 's3://.*')"
complete -c s3cmd -f -n "__s3cmd_is_remote_path"
# Supress file completions for initial command