Skip to content

Commit

Permalink
Merge pull request #899 from rsteube/bash-handle-err
Browse files Browse the repository at this point in the history
bash: handle shlex error
  • Loading branch information
rsteube authored Aug 12, 2023
2 parents 5f2f63e + 666a759 commit 7c17004
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ func complete(cmd *cobra.Command, args []string) (string, error) {
var err error
args, err = bash.Patch(args) // handle redirects
LOG.Printf("patching args to %#v", args)
if _, ok := err.(bash.RedirectError); ok {
LOG.Printf("completing redirect target for %#v", args)
if err != nil {
context := NewContext(args...)
return ActionFiles().Invoke(context).value(args[0], args[len(args)-1]), nil
if _, ok := err.(bash.RedirectError); ok {
LOG.Printf("completing redirect target for %#v", args)
return ActionFiles().Invoke(context).value(args[0], args[len(args)-1]), nil
}
return ActionMessage(err.Error()).Invoke(context).value(args[0], args[len(args)-1]), nil
}
}

Expand Down

0 comments on commit 7c17004

Please sign in to comment.