Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ before:
# You may remove this if you don't use go modules.
- go mod tidy


builds:

- env:
Expand All @@ -28,6 +27,8 @@ builds:


archives:
- files:
- docs/*
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
Expand Down Expand Up @@ -64,6 +65,8 @@ brews:
description: "OpenStatus CLI"
test: |
system "#{bin}/openstatus --help"
extra_install: |
man1.install "docs/openstatus-docs"
repository:
# Repository owner.
#
Expand Down
1 change: 1 addition & 0 deletions cmd/openstatus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func main() {
app := &cli.Command{
Name: "openstatus",
Usage: "This is OpenStatus Command Line Interface",
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",
Version: "v0.0.3",
Commands: []*cli.Command{
monitors.MonitorsCmd(),
Expand Down
87 changes: 87 additions & 0 deletions docs/openstatus-docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
.\" Automatically generated by Pandoc 3.7.0.2
.\"
.TH "" "" "" ""
.SH CLI
.SH NAME
openstatus \- This is OpenStatus Command Line Interface
.SH SYNOPSIS
openstatus
.SH DESCRIPTION
OpenStatus is a command line interface for managing your monitors and
triggering your synthetics tests.
.PP
Please report any issues at
https://github.com/openstatusHQ/cli/issues/new
.PP
\f[B]Usage\f[R]:
.IP
.EX
openstatus [GLOBAL OPTIONS] [command [COMMAND OPTIONS]] [ARGUMENTS...]
.EE
.SH COMMANDS
.SS monitors
Manage your monitors
.SS create
Create monitors (beta)
.RS
.PP
openstatus monitors create [options]
.RE
.PP
\f[B]\(enaccess\-token, \-t\f[R]=\(lq\(lq: OpenStatus API Access Token
.PP
\f[B]\(enauto\-accept, \-y\f[R]: Automatically accept the prompt
.PP
\f[B]\(enconfig\f[R]=\(lq\(lq: The configuration file containing monitor
information (default: openstatus.yaml)
.SS delete
Delete a monitor
.RS
.PP
openstatus monitors delete [MonitorID] [options]
.RE
.PP
\f[B]\(enaccess\-token, \-t\f[R]=\(lq\(lq: OpenStatus API Access Token
.PP
\f[B]\(enauto\-accept, \-y\f[R]: Automatically accept the prompt
.SS info
Get monitor information
.PP
\f[B]\(enaccess\-token, \-t\f[R]=\(lq\(lq: OpenStatus API Access Token
.SS list
List all monitors
.RS
.PP
openstatus monitors list [options]
.RE
.PP
\f[B]\(enaccess\-token, \-t\f[R]=\(lq\(lq: OpenStatus API Access Token
.PP
\f[B]\(enall\f[R]: List all monitors including inactive ones
.SS trigger
Trigger a monitor test
.RS
.PP
openstatus monitors trigger [MonitorId] [options]
.RE
.PP
\f[B]\(enaccess\-token, \-t\f[R]=\(lq\(lq: OpenStatus API Access Token
.SS run, r
Run your synthetics tests
.RS
.PP
openstatus run[options]
.RE
.PP
\f[B]\(enaccess\-token, \-t\f[R]=\(lq\(lq: OpenStatus API Access Token
.PP
\f[B]\(enconfig\f[R]=\(lq\(lq: The configuration file (default:
config.openstatus.yaml)
.SS whoami, w
Get your current workspace information
.RS
.PP
openstatus whoami [options]
.RE
.PP
\f[B]\(enaccess\-token, \-t\f[R]=\(lq\(lq: OpenStatus API Access Token
91 changes: 91 additions & 0 deletions docs/openstatus-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# CLI

# NAME

openstatus - This is OpenStatus Command Line Interface

# SYNOPSIS

openstatus

# DESCRIPTION

OpenStatus is a command line interface for managing your monitors and triggering your synthetics tests.

Please report any issues at https://github.com/openstatusHQ/cli/issues/new

**Usage**:

```
openstatus [GLOBAL OPTIONS] [command [COMMAND OPTIONS]] [ARGUMENTS...]
```

# COMMANDS

## monitors

Manage your monitors

### create

Create monitors (beta)

>openstatus monitors create [options]

**--access-token, -t**="": OpenStatus API Access Token

**--auto-accept, -y**: Automatically accept the prompt

**--config**="": The configuration file containing monitor information (default: openstatus.yaml)

### delete

Delete a monitor

>openstatus monitors delete [MonitorID] [options]

**--access-token, -t**="": OpenStatus API Access Token

**--auto-accept, -y**: Automatically accept the prompt

### info

Get monitor information

**--access-token, -t**="": OpenStatus API Access Token

### list

List all monitors

>openstatus monitors list [options]

**--access-token, -t**="": OpenStatus API Access Token

**--all**: List all monitors including inactive ones

### trigger

Trigger a monitor test

>openstatus monitors trigger [MonitorId] [options]

**--access-token, -t**="": OpenStatus API Access Token

## run, r

Run your synthetics tests

>openstatus run[options]

**--access-token, -t**="": OpenStatus API Access Token

**--config**="": The configuration file (default: config.openstatus.yaml)

## whoami, w

Get your current workspace information

>openstatus whoami [options]

**--access-token, -t**="": OpenStatus API Access Token
11 changes: 10 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,26 @@ require (
github.com/knadh/koanf/parsers/yaml v0.1.0
github.com/knadh/koanf/providers/file v1.1.2
github.com/knadh/koanf/v2 v2.1.1
github.com/logrusorgru/aurora/v4 v4.0.0
github.com/olekukonko/tablewriter v1.0.7
github.com/rodaine/table v1.3.0
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
github.com/knadh/koanf/maps v0.1.2 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/olekukonko/errors v0.0.0-20250405072817-4e6d85265da6 // indirect
github.com/olekukonko/ll v0.0.8 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/urfave/cli-docs/v3 v3.0.0-alpha6 // indirect
golang.org/x/sys v0.26.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
18 changes: 16 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -9,14 +11,16 @@ github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIx
github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs=
github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI=
github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo=
github.com/knadh/koanf/maps v0.1.2/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI=
github.com/knadh/koanf/parsers/yaml v0.1.0 h1:ZZ8/iGfRLvKSaMEECEBPM1HQslrZADk8fP1XFUxVI5w=
github.com/knadh/koanf/parsers/yaml v0.1.0/go.mod h1:cvbUDC7AL23pImuQP0oRw/hPuccrNBS2bps8asS0CwY=
github.com/knadh/koanf/providers/file v1.1.2 h1:aCC36YGOgV5lTtAFz2qkgtWdeQsgfxUkxDOe+2nQY3w=
github.com/knadh/koanf/providers/file v1.1.2/go.mod h1:/faSBcv2mxPVjFrXck95qeoyoZ5myJ6uxN8OOVNJJCI=
github.com/knadh/koanf/v2 v2.1.1 h1:/R8eXqasSTsmDCsAyYj+81Wteg8AqrV9CP6gvsTsOmM=
github.com/knadh/koanf/v2 v2.1.1/go.mod h1:4mnTRbZCK+ALuBXHZMjDfG9y714L7TykVnZkXbMU3Es=
github.com/logrusorgru/aurora/v4 v4.0.0 h1:sRjfPpun/63iADiSvGGjgA1cAYegEWMPCJdUpJYn9JA=
github.com/logrusorgru/aurora/v4 v4.0.0/go.mod h1:lP0iIa2nrnT/qoFXcOZSrZQpJ1o6n2CUf/hyHi2Q4ZQ=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
Expand All @@ -28,12 +32,20 @@ github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa1
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/olekukonko/errors v0.0.0-20250405072817-4e6d85265da6 h1:r3FaAI0NZK3hSmtTDrBVREhKULp8oUeqLT5Eyl2mSPo=
github.com/olekukonko/errors v0.0.0-20250405072817-4e6d85265da6/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y=
github.com/olekukonko/ll v0.0.8 h1:sbGZ1Fx4QxJXEqL/6IG8GEFnYojUSQ45dJVwN2FH2fc=
github.com/olekukonko/ll v0.0.8/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g=
github.com/olekukonko/tablewriter v1.0.7 h1:HCC2e3MM+2g72M81ZcJU11uciw6z/p82aEnm4/ySDGw=
github.com/olekukonko/tablewriter v1.0.7/go.mod h1:H428M+HzoUXC6JU2Abj9IT9ooRmdq9CxuDmKMtrOCMs=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rodaine/table v1.3.0 h1:4/3S3SVkHnVZX91EHFvAMV7K42AnJ0XuymRR2C5HlGE=
github.com/rodaine/table v1.3.0/go.mod h1:47zRsHar4zw0jgxGxL9YtFfs7EGN6B/TaS+/Dmk4WxU=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand All @@ -43,6 +55,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/urfave/cli-docs/v3 v3.0.0-alpha6 h1:w/l/N0xw1rO/aHRIGXJ0lDwwYFOzilup1qGvIytP3BI=
github.com/urfave/cli-docs/v3 v3.0.0-alpha6/go.mod h1:p7Z4lg8FSTrPB9GTaNyTrK3ygffHZcK3w0cU2VE+mzU=
github.com/urfave/cli/v3 v3.0.0-alpha9.2 h1:CL8llQj3dGRLVQQzHxS+ZYRLanOuhyK1fXgLKD+qV+Y=
github.com/urfave/cli/v3 v3.0.0-alpha9.2/go.mod h1:FnIeEMYu+ko8zP1F9Ypr3xkZMIDqW3DR92yUtY39q1Y=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
22 changes: 22 additions & 0 deletions internal/cli/confirmation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cli

import (
"bufio"
"fmt"
"os"
"strings"
)

func AskForConfirmation(s string) bool {
reader := bufio.NewReader(os.Stdin)
fmt.Printf("%s [y/N]: ", s)
response, err := reader.ReadString('\n')
if err != nil {
panic(err)
}
response = strings.ToLower(strings.TrimSpace(response))
if response == "y" || response == "yes" {
return true
}
return false
}
Loading