Skip to content

Commit 90a0737

Browse files
committed
subcommand: add 'Description()' to interface
To set up for future patches in which we'll improve the command-line reporting for 'git-bundle-server' commands, add a public 'Description()' function to require each command to include a string description of its action. Signed-off-by: Victoria Dye <[email protected]>
1 parent b0fe1be commit 90a0737

File tree

7 files changed

+37
-0
lines changed

7 files changed

+37
-0
lines changed

cmd/git-bundle-server/delete.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ func (Delete) Name() string {
1313
return "delete"
1414
}
1515

16+
func (Delete) Description() string {
17+
return `
18+
Remove the configuration for the given '<route>' and delete its repository
19+
data.`
20+
}
21+
1622
func (Delete) run(args []string) error {
1723
if len(args) < 1 {
1824
return errors.New("usage: git-bundle-server delete <route>")

cmd/git-bundle-server/init.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ func (Init) Name() string {
1515
return "init"
1616
}
1717

18+
func (Init) Description() string {
19+
return `
20+
Initialize a repository by cloning a bare repo from '<url>', whose bundles
21+
should be hosted at '<route>'.`
22+
}
23+
1824
func (Init) run(args []string) error {
1925
if len(args) < 2 {
2026
// TODO: allow parsing <route> out of <url>

cmd/git-bundle-server/start.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ func (Start) Name() string {
1414
return "start"
1515
}
1616

17+
func (Start) Description() string {
18+
return `
19+
Start computing bundles and serving content for the repository at the
20+
specified '<route>'.`
21+
}
22+
1723
func (Start) run(args []string) error {
1824
if len(args) < 1 {
1925
return errors.New("usage: git-bundle-server start <route>")

cmd/git-bundle-server/stop.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ func (Stop) Name() string {
1212
return "stop"
1313
}
1414

15+
func (Stop) Description() string {
16+
return `
17+
Stop computing bundles or serving content for the repository at the
18+
specified '<route>'.`
19+
}
20+
1521
func (Stop) run(args []string) error {
1622
if len(args) < 1 {
1723
return errors.New("usage: git-bundle-server stop <route>")

cmd/git-bundle-server/subcommand.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
type Subcommand interface {
44
Name() string
5+
Description() string
56
run(args []string) error
67
}
78

cmd/git-bundle-server/update-all.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ func (UpdateAll) Name() string {
1414
return "update-all"
1515
}
1616

17+
func (UpdateAll) Description() string {
18+
return `
19+
For every configured route, run 'git-bundle-server update <options> <route>'.`
20+
}
21+
1722
func (UpdateAll) run(args []string) error {
1823
exe, err := os.Executable()
1924
if err != nil {

cmd/git-bundle-server/update.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ func (Update) Name() string {
1414
return "update"
1515
}
1616

17+
func (Update) Description() string {
18+
return `
19+
For the repository in the current directory (or the one specified by
20+
'<route>'), fetch the latest content from the remote, create a new set of
21+
bundles, and update the bundle list.`
22+
}
23+
1724
func (Update) run(args []string) error {
1825
if len(args) != 1 {
1926
// TODO: allow parsing <route> out of <url>

0 commit comments

Comments
 (0)