blob: 5338d6b26d05ecda6b3e0705a656103ace9a9fd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package commandargs
import (
"gitlab.com/gitlab-org/gitlab-shell/go/internal/executable"
)
type CommandType string
type CommandArgs interface {
Parse() error
GetArguments() []string
}
func Parse(e *executable.Executable, arguments []string) (CommandArgs, error) {
var args CommandArgs = &GenericArgs{Arguments: arguments}
switch e.Name {
case executable.GitlabShell:
args = &Shell{Arguments: arguments}
}
if err := args.Parse(); err != nil {
return nil, err
}
return args, nil
}
|