Skip to content

Commit 27e7606

Browse files
committed
Add more CLI examples
1 parent c7c1abf commit 27e7606

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

cli/add.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ func add() *cobra.Command {
2323
cmd := &cobra.Command{
2424
Use: "add <source>",
2525
Short: "Add an extension to the marketplace",
26-
Args: cobra.ExactArgs(1),
26+
Example: strings.Join([]string{
27+
" marketplace add https://domain.tld/extension.vsix --extensions-dir ./extensions",
28+
" marketplace add extension.vsix --extensions-dir ./extensions",
29+
}, "\n"),
30+
Args: cobra.ExactArgs(1),
2731
RunE: func(cmd *cobra.Command, args []string) error {
2832
ctx, cancel := context.WithCancel(cmd.Context())
2933
defer cancel()

cli/root.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cli
22

33
import (
44
"github.com/spf13/cobra"
5+
"strings"
56
)
67

78
func Root() *cobra.Command {
@@ -10,7 +11,9 @@ func Root() *cobra.Command {
1011
SilenceErrors: true,
1112
SilenceUsage: true,
1213
Long: "Code extension marketplace",
13-
Example: " marketplace server --extensions-dir /path/to/extensions",
14+
Example: strings.Join([]string{
15+
" marketplace server --extensions-dir ./extensions",
16+
}, "\n"),
1417
}
1518

1619
cmd.AddCommand(add(), server(), version())

cli/server.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net/http"
88
"os/signal"
99
"path/filepath"
10+
"strings"
1011
"time"
1112

1213
"github.com/spf13/cobra"
@@ -30,6 +31,9 @@ func server() *cobra.Command {
3031
cmd := &cobra.Command{
3132
Use: "server",
3233
Short: "Start the Code extension marketplace",
34+
Example: strings.Join([]string{
35+
" marketplace server --extensions-dir ./extensions",
36+
}, "\n"),
3337
RunE: func(cmd *cobra.Command, args []string) error {
3438
ctx, cancel := context.WithCancel(cmd.Context())
3539
defer cancel()

0 commit comments

Comments
 (0)