diff options
author | Patrick Bajao <ebajao@gitlab.com> | 2019-07-29 15:56:00 +0800 |
---|---|---|
committer | Patrick Bajao <ebajao@gitlab.com> | 2019-07-31 12:03:37 +0800 |
commit | 3b0176df497263323da2fae793a79b568502e6db (patch) | |
tree | f4ff3e232bc3717c539d73a4f0460d6d12b4a6de /go/internal/command/fallback | |
parent | aab85f3600caf04b491d6ca4fc3f0f004d9e3fc0 (diff) | |
download | gitlab-shell-3b0176df497263323da2fae793a79b568502e6db.tar.gz |
Support different CommandArgs type
`CommandArgs` has been renamed to `Shell`.
An interface has been added that includes `Executable()` and
`Arguments()` method. The `BaseArgs` implement this methods
and should be embeeded in each type.
Diffstat (limited to 'go/internal/command/fallback')
-rw-r--r-- | go/internal/command/fallback/fallback.go | 7 | ||||
-rw-r--r-- | go/internal/command/fallback/fallback_test.go | 5 |
2 files changed, 6 insertions, 6 deletions
diff --git a/go/internal/command/fallback/fallback.go b/go/internal/command/fallback/fallback.go index cec94d5..81baaf5 100644 --- a/go/internal/command/fallback/fallback.go +++ b/go/internal/command/fallback/fallback.go @@ -9,14 +9,9 @@ import ( "gitlab.com/gitlab-org/gitlab-shell/go/internal/command/commandargs" ) -type CommandArgs interface { - Executable() commandargs.Executable - Arguments() []string -} - type Command struct { RootDir string - Args CommandArgs + Args commandargs.CommandArgs } var ( diff --git a/go/internal/command/fallback/fallback_test.go b/go/internal/command/fallback/fallback_test.go index 91dcb53..669aad1 100644 --- a/go/internal/command/fallback/fallback_test.go +++ b/go/internal/command/fallback/fallback_test.go @@ -25,6 +25,11 @@ type FakeCommandArgs struct { arguments []string } +func (f *FakeCommandArgs) Parse() error { + // Do nothing as no need to parse anything + return nil +} + func (f *FakeCommandArgs) Executable() commandargs.Executable { return f.executable } |