diff options
-rw-r--r-- | app/msgviewer.go | 8 | ||||
-rw-r--r-- | commands/compose/send.go | 8 | ||||
-rw-r--r-- | completer/completer.go | 7 | ||||
-rw-r--r-- | go.mod | 1 | ||||
-rw-r--r-- | go.sum | 2 |
5 files changed, 7 insertions, 19 deletions
diff --git a/app/msgviewer.go b/app/msgviewer.go index 8ac22bcc..abed93fd 100644 --- a/app/msgviewer.go +++ b/app/msgviewer.go @@ -13,7 +13,6 @@ import ( "github.com/danwakefield/fnmatch" "github.com/emersion/go-message/textproto" "github.com/gdamore/tcell/v2" - "github.com/google/shlex" "github.com/mattn/go-runewidth" "git.sr.ht/~rjarry/aerc/config" @@ -24,6 +23,7 @@ import ( "git.sr.ht/~rjarry/aerc/lib/ui" "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" + "git.sr.ht/~rjarry/go-opt" ) var _ ProvidesMessages = (*MessageViewer)(nil) @@ -431,11 +431,7 @@ func NewPartViewer( acct.PushError(fmt.Errorf("could not start pager: %w", err)) return nil, err } - cmd, err := shlex.Split(pagerCmd) - if err != nil { - return nil, err - } - + cmd := opt.SplitArgs(pagerCmd) pager = exec.Command(cmd[0], cmd[1:]...) info := msg.MessageInfo() diff --git a/commands/compose/send.go b/commands/compose/send.go index 6f905628..1047ebad 100644 --- a/commands/compose/send.go +++ b/commands/compose/send.go @@ -12,7 +12,6 @@ import ( "github.com/emersion/go-sasl" "github.com/emersion/go-smtp" - "github.com/google/shlex" "github.com/pkg/errors" "git.sr.ht/~rjarry/aerc/app" @@ -23,6 +22,7 @@ import ( "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" + "git.sr.ht/~rjarry/go-opt" "github.com/emersion/go-message/mail" "golang.org/x/oauth2" ) @@ -271,10 +271,7 @@ type sendCtx struct { } func newSendmailSender(ctx sendCtx) (io.WriteCloser, error) { - args, err := shlex.Split(ctx.uri.Path) - if err != nil { - return nil, err - } + args := opt.SplitArgs(ctx.uri.Path) if len(args) == 0 { return nil, fmt.Errorf("no command specified") } @@ -286,6 +283,7 @@ func newSendmailSender(ctx sendCtx) (io.WriteCloser, error) { args = append(args[1:], rs...) cmd := exec.Command(bin, args...) s := &sendmailSender{cmd: cmd} + var err error s.stdin, err = s.cmd.StdinPipe() if err != nil { return nil, errors.Wrap(err, "cmd.StdinPipe") diff --git a/completer/completer.go b/completer/completer.go index 9b237fa8..647e9ed7 100644 --- a/completer/completer.go +++ b/completer/completer.go @@ -13,7 +13,7 @@ import ( "syscall" "git.sr.ht/~rjarry/aerc/log" - "github.com/google/shlex" + "git.sr.ht/~rjarry/go-opt" ) // A Completer is used to autocomplete text inputs based on the configured @@ -142,10 +142,7 @@ func (c *Completer) getAddressCmd(s string) (*exec.Cmd, error) { return nil, fmt.Errorf("no command configured") } queryCmd := strings.ReplaceAll(c.AddressBookCmd, "%s", s) - parts, err := shlex.Split(queryCmd) - if err != nil { - return nil, fmt.Errorf("could not lex command") - } + parts := opt.SplitArgs(queryCmd) if len(parts) < 1 { return nil, fmt.Errorf("empty command") } @@ -23,7 +23,6 @@ require ( github.com/gatherstars-com/jwz v1.4.0 github.com/gdamore/tcell/v2 v2.6.0 github.com/go-ini/ini v1.67.0 - github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 github.com/lithammer/fuzzysearch v1.1.5 github.com/mattn/go-isatty v0.0.18 github.com/mattn/go-runewidth v0.0.14 @@ -82,8 +82,6 @@ github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk= |