diff options
author | Patrick Bajao <ebajao@gitlab.com> | 2019-08-02 16:10:17 +0800 |
---|---|---|
committer | Patrick Bajao <ebajao@gitlab.com> | 2019-08-02 16:10:17 +0800 |
commit | 3b6f9f7583755e041e76142d7caf7716937907fa (patch) | |
tree | ed7f7281633d97933e4465a2ac0f86d62c9a216e /go/internal/command/commandargs/base_args.go | |
parent | 592823d5e25006331b361b36cc61df7802fc1938 (diff) | |
download | gitlab-shell-3b6f9f7583755e041e76142d7caf7716937907fa.tar.gz |
Add Executable struct181-migrate-gitlab-shell-checks-fallback
This struct is responsible for determining the name and
root dir of the executable.
The `RootDir` property will be used to find the config.
The `Name` property will be used to determine what `Command`
and `CommandArgs` to be built.
Diffstat (limited to 'go/internal/command/commandargs/base_args.go')
-rw-r--r-- | go/internal/command/commandargs/base_args.go | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/go/internal/command/commandargs/base_args.go b/go/internal/command/commandargs/base_args.go deleted file mode 100644 index f65373e..0000000 --- a/go/internal/command/commandargs/base_args.go +++ /dev/null @@ -1,34 +0,0 @@ -package commandargs - -import ( - "errors" - "path/filepath" -) - -type BaseArgs struct { - arguments []string -} - -func (b *BaseArgs) Parse() error { - if b.hasEmptyArguments() { - return errors.New("arguments should include the executable") - } - - return nil -} - -func (b *BaseArgs) Executable() Executable { - if b.hasEmptyArguments() { - return Executable("") - } - - return Executable(filepath.Base(b.arguments[0])) -} - -func (b *BaseArgs) Arguments() []string { - return b.arguments[1:] -} - -func (b *BaseArgs) hasEmptyArguments() bool { - return len(b.arguments) == 0 -} |