From 8b4621aa6cba1674192ffb6e3c3e801a567f2516 Mon Sep 17 00:00:00 2001 From: feistel <6742251-feistel@users.noreply.gitlab.com> Date: Wed, 8 Sep 2021 09:54:44 +0000 Subject: refactor: add acceptargs field to executable parse logic will only run if the executable accept args. healthcheck is the only one not accepting arguments. --- internal/command/command.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'internal/command/command.go') diff --git a/internal/command/command.go b/internal/command/command.go index 6696f0f..dadf41a 100644 --- a/internal/command/command.go +++ b/internal/command/command.go @@ -29,9 +29,13 @@ type Command interface { } func New(e *executable.Executable, arguments []string, env sshenv.Env, config *config.Config, readWriter *readwriter.ReadWriter) (Command, error) { - args, err := commandargs.Parse(e, arguments, env) - if err != nil { - return nil, err + var args commandargs.CommandArgs + if e.AcceptArgs { + var err error + args, err = commandargs.Parse(e, arguments, env) + if err != nil { + return nil, err + } } if cmd := buildCommand(e, args, config, readWriter); cmd != nil { -- cgit v1.2.1