Skip to content

Commit 3914bb5

Browse files
⬆︎ v0.0.7 (#8)
1 parent 8958acc commit 3914bb5

18 files changed

Lines changed: 60 additions & 245 deletions

cmd/docs/docs.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
21
package main
32

43
import (
54
"os"
65

7-
docs "github.com/urfave/cli-docs/v3"
86
cmd "github.com/openstatusHQ/cli/internal/cmd"
7+
docs "github.com/urfave/cli-docs/v3"
98
)
109

1110
func main() {
12-
app := cmd.NewApp()
11+
app := cmd.NewApp()
1312
md, err := docs.ToMarkdown(app)
1413
if err != nil {
1514
panic(err)

cmd/openstatus/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package main
22

33
import (
44
"context"
5+
cmd "github.com/openstatusHQ/cli/internal/cmd"
56
"log"
67
"os"
7-
cmd "github.com/openstatusHQ/cli/internal/cmd"
88
)
99

1010
func main() {

docs/openstatus-docs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ openstatus
1010

1111
# DESCRIPTION
1212

13-
OpenStatus is a command line interface for managing your monitors and triggering your synthetics tests.
13+
OpenStatus is a command line interface for managing your monitors and triggering your synthetics tests.
1414

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

internal/cmd/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func NewApp() *cli.Command {
1313
Suggest: true,
1414
Usage: "This is OpenStatus Command Line Interface, the OpenStatus.dev CLI",
1515
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",
16-
Version: "v0.0.6",
16+
Version: "v0.0.7",
1717
Commands: []*cli.Command{
1818
monitors.MonitorsCmd(),
1919
run.RunCmd(),

internal/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func ReadConfig(path string) (*Config, error) {
2121

2222
file := file.Provider(path)
2323

24-
err:= k.Load(file, yaml.Parser())
24+
err := k.Load(file, yaml.Parser())
2525

2626
if err != nil {
2727
return nil, err

internal/config/monitor.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ package config
22

33
type Monitor struct {
44
// Name of the monitor
5-
Name string `json:"name" ,yaml:"name"`
6-
Description string `json:"description,omitempty" ,yaml:"description,omitempty"`
7-
Frequency Frequency `json:"frequency" ,yaml:"frequency"`
5+
Name string `json:"name" ,yaml:"name"`
6+
Description string `json:"description,omitempty" ,yaml:"description,omitempty"`
7+
Frequency Frequency `json:"frequency" ,yaml:"frequency"`
88
// Regions to run the request in
99
Regions []Region `json:"regions" ,yaml:"regions"`
1010
// Whether the monitor is active
11-
Active bool `json:"active"`
12-
Kind CoordinateKind `json:"kind" ,yaml:"kind"`
11+
Active bool `json:"active"`
12+
Kind CoordinateKind `json:"kind" ,yaml:"kind"`
1313
// Number of retries to attempt
1414
Retry int64 `json:"retry,omitempty" ,yaml:"retry,omitempty"`
1515
// Whether the monitor is public
1616
Public bool `json:"public,omitempty" ,yaml:"public,omitempty"`
1717
// The HTTP Request we are sending
1818
Request Request `json:"request" ,yaml:"request"`
1919
// Time in milliseconds to wait before marking the request as degraded
20-
DegradedAfter int64 `json:"degradedAfter,omitempty" ,yaml:"degradedAfter,omitempty"`
20+
DegradedAfter int64 `json:"degradedAfter,omitempty" ,yaml:"degradedAfter,omitempty"`
2121
// Time in milliseconds to wait before marking the request as timed out
2222
Timeout int64 `json:"timeout,omitempty" ,yaml:"timeout,omitempty"`
2323
// Assertions to run on the response

internal/config/openstatus.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import (
77

88
type Monitors map[string]Monitor
99

10-
11-
1210
func ReadOpenStatus(path string) ([]Monitor, error) {
1311
f := file.Provider(path)
1412

@@ -39,7 +37,6 @@ func ReadOpenStatus(path string) ([]Monitor, error) {
3937
}
4038
}
4139

42-
4340
var monitor []Monitor
4441
for _, value := range out {
4542
for _, assertion := range value.Assertions {

internal/monitors/monitor_create.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ func CreateMonitor(httpClient *http.Client, apiKey string, monitor config.Monito
4848

4949
func GetMonitorCreateCmd() *cli.Command {
5050
monitorInfoCmd := cli.Command{
51-
Name: "create",
52-
Usage: "Create monitors (beta)",
51+
Name: "create",
52+
Usage: "Create monitors (beta)",
5353
Description: "Create the monitors defined in the openstatus.yaml file",
54-
UsageText: "openstatus monitors create [options]",
54+
UsageText: "openstatus monitors create [options]",
5555

5656
Action: func(ctx context.Context, cmd *cli.Command) error {
5757

internal/monitors/monitor_delete.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import (
1111
"github.com/urfave/cli/v3"
1212
)
1313

14-
15-
1614
func DeleteMonitor(httpClient *http.Client, apiKey string, monitorId string) error {
1715

1816
if monitorId == "" {
@@ -50,8 +48,8 @@ func DeleteMonitor(httpClient *http.Client, apiKey string, monitorId string) err
5048

5149
func GetMonitorDeleteCmd() *cli.Command {
5250
monitorsCmd := cli.Command{
53-
Name: "delete",
54-
Usage: "Delete a monitor",
51+
Name: "delete",
52+
Usage: "Delete a monitor",
5553
UsageText: "openstatus monitors delete [MonitorID] [options]",
5654

5755
Flags: []cli.Flag{

internal/monitors/monitor_export.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"sigs.k8s.io/yaml"
1616
)
1717

18-
func ExportMonitor(httpClient *http.Client, apiKey string, path string ) error {
18+
func ExportMonitor(httpClient *http.Client, apiKey string, path string) error {
1919
url := "https://api.openstatus.dev/v1/monitor"
2020

2121
req, _ := http.NewRequest(http.MethodGet, url, nil)
@@ -74,10 +74,10 @@ func ExportMonitor(httpClient *http.Client, apiKey string, path string ) error {
7474
}
7575

7676
assertions = append(assertions, config.Assertion{
77-
Kind: kind,
78-
Target: assertion.Target,
77+
Kind: kind,
78+
Target: assertion.Target,
7979
Compare: config.Compare(assertion.Compare),
80-
Key: assertion.Key,
80+
Key: assertion.Key,
8181
})
8282
}
8383

@@ -109,10 +109,10 @@ func ExportMonitor(httpClient *http.Client, apiKey string, path string ) error {
109109
DegradedAfter: int64(monitor.DegradedAfter),
110110
Frequency: config.Frequency(monitor.Periodicity),
111111
// Regions: monitor.Regions,
112-
Request: request,
113-
Kind: config.CoordinateKind(monitor.JobType),
114-
Retry: int64(monitor.Retry),
115-
Regions: regions,
112+
Request: request,
113+
Kind: config.CoordinateKind(monitor.JobType),
114+
Retry: int64(monitor.Retry),
115+
Regions: regions,
116116
Assertions: assertions,
117117
}
118118
}
@@ -136,8 +136,8 @@ func ExportMonitor(httpClient *http.Client, apiKey string, path string ) error {
136136

137137
func GetMonitorExportCmd() *cli.Command {
138138
monitorInfoCmd := cli.Command{
139-
Name: "export",
140-
Usage: "Export all your monitors",
139+
Name: "export",
140+
Usage: "Export all your monitors",
141141
UsageText: "openstatus monitor export [options]",
142142
Description: "Export all your monitors to YAML",
143143
Action: func(ctx context.Context, cmd *cli.Command) error {
@@ -162,7 +162,7 @@ func GetMonitorExportCmd() *cli.Command {
162162
Usage: "The output file name ",
163163
DefaultText: "openstatus.yaml",
164164
Value: "openstatus.yaml",
165-
Aliases: []string{"o"},
165+
Aliases: []string{"o"},
166166
},
167167
},
168168
}

0 commit comments

Comments
 (0)