Skip to content

Commit dbfb398

Browse files
πŸ“š docs (#6)
* πŸ“š docs * πŸ§ͺ fix test
1 parent d4f6972 commit dbfb398

File tree

7 files changed

+74
-29
lines changed

7 files changed

+74
-29
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ OpenStatus CLI is a command line interface for OpenStatus.
55
## Installation
66

77
```bash
8-
brew tap openstatus/cli
8+
brew tap openstatusHQ/cli
99
brew install openstatus
1010
```
11+
12+
13+
## Development
14+
15+
### Docs
16+
17+
Run this command to generate the documentation:
18+
19+
```bash
20+
go run cmd/docs/docs.go
21+
```

β€Žcmd/docs/docs.goβ€Ž

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
package main
3+
4+
import (
5+
"os"
6+
7+
docs "github.com/urfave/cli-docs/v3"
8+
cmd "github.com/openstatusHQ/cli/internal/cmd"
9+
)
10+
11+
func main() {
12+
app := cmd.NewApp()
13+
md, err := docs.ToMarkdown(app)
14+
if err != nil {
15+
panic(err)
16+
}
17+
18+
fi, err := os.Create("./docs/openstatus-docs.md")
19+
if err != nil {
20+
panic(err)
21+
}
22+
defer fi.Close()
23+
if _, err := fi.WriteString("# OpenStatus CLI\n\n" + md); err != nil {
24+
panic(err)
25+
}
26+
}

β€Žcmd/openstatus/main.goβ€Ž

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,13 @@ package main
22

33
import (
44
"context"
5-
"fmt"
65
"log"
76
"os"
8-
9-
"github.com/openstatusHQ/cli/internal/monitors"
10-
"github.com/openstatusHQ/cli/internal/run"
11-
"github.com/openstatusHQ/cli/internal/whoami"
12-
"github.com/urfave/cli/v3"
7+
cmd "github.com/openstatusHQ/cli/internal/cmd"
138
)
149

1510
func main() {
16-
app := &cli.Command{
17-
Name: "openstatus",
18-
Suggest: true,
19-
Usage: "This is OpenStatus Command Line Interface",
20-
UsageText: "openstatus [command] [flags]",
21-
Description: "OpenStatus is a command line interface for managing your monitors and triggering your synthetics tests.",
22-
Version: "v0.0.4",
23-
Commands: []*cli.Command{
24-
monitors.MonitorsCmd(),
25-
run.RunCmd(),
26-
whoami.WhoamiCmd(),
27-
},
28-
EnableShellCompletion: true,
29-
30-
Action: func(ctx context.Context, cmd *cli.Command) error {
31-
cli.ShowAppHelp(cmd)
32-
fmt.Println("\n\nPlease report any issues at https://github.com/openstatusHQ/cli/issues/new")
33-
return nil
34-
},
35-
}
11+
app := cmd.NewApp()
3612

3713
if err := app.Run(context.Background(), os.Args); err != nil {
3814
log.Fatal(err)

β€Ždocs/openstatus-docs.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# CLI
1+
# OpenStatus CLI
22

33
# NAME
44

β€Žgo.modβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ require (
1212
github.com/logrusorgru/aurora/v4 v4.0.0
1313
github.com/olekukonko/tablewriter v1.0.7
1414
github.com/rodaine/table v1.3.0
15+
github.com/urfave/cli-docs/v3 v3.0.0-alpha6
16+
sigs.k8s.io/yaml v1.4.0
1517
)
1618

1719
require (
20+
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
1821
github.com/fsnotify/fsnotify v1.7.0 // indirect
1922
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
2023
github.com/knadh/koanf/maps v0.1.2 // indirect
@@ -26,7 +29,7 @@ require (
2629
github.com/olekukonko/errors v0.0.0-20250405072817-4e6d85265da6 // indirect
2730
github.com/olekukonko/ll v0.0.8 // indirect
2831
github.com/rivo/uniseg v0.2.0 // indirect
32+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
2933
golang.org/x/sys v0.26.0 // indirect
3034
gopkg.in/yaml.v3 v3.0.1 // indirect
31-
sigs.k8s.io/yaml v1.4.0 // indirect
3235
)

β€Žgo.sumβ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
2+
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
13
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
24
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
35
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -43,6 +45,8 @@ github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
4345
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
4446
github.com/rodaine/table v1.3.0 h1:4/3S3SVkHnVZX91EHFvAMV7K42AnJ0XuymRR2C5HlGE=
4547
github.com/rodaine/table v1.3.0/go.mod h1:47zRsHar4zw0jgxGxL9YtFfs7EGN6B/TaS+/Dmk4WxU=
48+
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
49+
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
4650
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
4751
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
4852
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
@@ -52,6 +56,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
5256
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
5357
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
5458
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
59+
github.com/urfave/cli-docs/v3 v3.0.0-alpha6 h1:w/l/N0xw1rO/aHRIGXJ0lDwwYFOzilup1qGvIytP3BI=
60+
github.com/urfave/cli-docs/v3 v3.0.0-alpha6/go.mod h1:p7Z4lg8FSTrPB9GTaNyTrK3ygffHZcK3w0cU2VE+mzU=
5561
github.com/urfave/cli/v3 v3.0.0-alpha9.2 h1:CL8llQj3dGRLVQQzHxS+ZYRLanOuhyK1fXgLKD+qV+Y=
5662
github.com/urfave/cli/v3 v3.0.0-alpha9.2/go.mod h1:FnIeEMYu+ko8zP1F9Ypr3xkZMIDqW3DR92yUtY39q1Y=
5763
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

β€Žinternal/cmd/app.goβ€Ž

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package cmd
2+
3+
import (
4+
"github.com/openstatusHQ/cli/internal/monitors"
5+
"github.com/openstatusHQ/cli/internal/run"
6+
"github.com/openstatusHQ/cli/internal/whoami"
7+
"github.com/urfave/cli/v3"
8+
)
9+
10+
func NewApp() *cli.Command {
11+
app := &cli.Command{
12+
Name: "openstatus",
13+
Usage: "This is OpenStatus Command Line Interface",
14+
Description: "OpenStatus is a command line interface for managing your monitors and triggering your synthetics tests. \n\nPlease report any issues at https://github.com/openstatusHQ/cli/issues/new",
15+
Version: "v0.0.4",
16+
Commands: []*cli.Command{
17+
monitors.MonitorsCmd(),
18+
run.RunCmd(),
19+
whoami.WhoamiCmd(),
20+
},
21+
}
22+
return app
23+
}

0 commit comments

Comments
Β (0)