Skip to content

Commit d6ef794

Browse files
committed
subcommand: move to 'argparse' package
Move the 'Subcommand' interface from the 'main' package of 'git-bundle-server' to the internal 'argparse' library so that it can be used by the parser as a general representation of an invokable command/subcommand. Additionally, keep the 'all()' function in the 'main' package by moving it to 'main.go'. Signed-off-by: Victoria Dye <[email protected]>
1 parent a05d798 commit d6ef794

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

cmd/git-bundle-server/main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,21 @@ package main
33
import (
44
"log"
55
"os"
6+
7+
"github.com/github/git-bundle-server/internal/argparse"
68
)
79

10+
func all() []argparse.Subcommand {
11+
return []argparse.Subcommand{
12+
Delete{},
13+
Init{},
14+
Start{},
15+
Stop{},
16+
Update{},
17+
UpdateAll{},
18+
}
19+
}
20+
821
func main() {
922
cmds := all()
1023

cmd/git-bundle-server/subcommand.go

Lines changed: 0 additions & 18 deletions
This file was deleted.

internal/argparse/subcommand.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package argparse
2+
3+
type Subcommand interface {
4+
Name() string
5+
Description() string
6+
Run(args []string) error
7+
}

0 commit comments

Comments
 (0)