diff options
author | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-09-08 09:54:44 +0000 |
---|---|---|
committer | feistel <6742251-feistel@users.noreply.gitlab.com> | 2021-09-08 09:54:44 +0000 |
commit | 8b4621aa6cba1674192ffb6e3c3e801a567f2516 (patch) | |
tree | 734e8bd67a8a14d4c9d87c049638f0a8d38171b3 /internal/command/command.go | |
parent | 4f5b7512c3c1ad7b67b044976b5ac3aae413beb2 (diff) | |
download | gitlab-shell-8b4621aa6cba1674192ffb6e3c3e801a567f2516.tar.gz |
refactor: add acceptargs field to executable
parse logic will only run if the executable accept args.
healthcheck is the only one not accepting arguments.
Diffstat (limited to 'internal/command/command.go')
-rw-r--r-- | internal/command/command.go | 10 |
1 files changed, 7 insertions, 3 deletions
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 { |