blob: 9f28817c1053035c8f0e2feaa81b12de8f061427 (
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
28
29
|
package commandargs
type CommandType string
type Executable string
const (
GitlabShell Executable = "gitlab-shell"
)
type CommandArgs interface {
Parse() error
Executable() Executable
Arguments() []string
}
func Parse(arguments []string) (CommandArgs, error) {
var args CommandArgs = &BaseArgs{arguments: arguments}
switch args.Executable() {
case GitlabShell:
args = &Shell{BaseArgs: args.(*BaseArgs)}
}
if err := args.Parse(); err != nil {
return nil, err
}
return args, nil
}
|