From 5a13f0bd06297cb71944cf995138545c6643aa26 Mon Sep 17 00:00:00 2001 From: Paul Ouellette Date: Mon, 29 Jul 2019 20:35:38 -0400 Subject: [PATCH] Fix bash completion error --- spec/completion_spec.lua | 2 +- src/argparse.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/completion_spec.lua b/spec/completion_spec.lua index 94b3927..0f5bdd9 100644 --- a/spec/completion_spec.lua +++ b/spec/completion_spec.lua @@ -31,7 +31,7 @@ _comptest() { return 0 ;; -f|--files) - COMPREPLY=($(compgen -f "$cur")) + COMPREPLY=($(compgen -f -- "$cur")) return 0 ;; esac diff --git a/src/argparse.lua b/src/argparse.lua index 16d458d..bae8fdc 100644 --- a/src/argparse.lua +++ b/src/argparse.lua @@ -1218,7 +1218,7 @@ function Parser:_bash_option_args(buf, indent) if option._choices then compreply = 'COMPREPLY=($(compgen -W "' .. table.concat(option._choices, " ") .. '" -- "$cur"))' else - compreply = 'COMPREPLY=($(compgen -f "$cur"))' + compreply = 'COMPREPLY=($(compgen -f -- "$cur"))' end table.insert(opts, (" "):rep(indent + 4) .. table.concat(option._aliases, "|") .. ")") table.insert(opts, (" "):rep(indent + 8) .. compreply)