Skip to content

Commit

Permalink
revert flag changes
Browse files Browse the repository at this point in the history
  • Loading branch information
radulucut committed Mar 22, 2024
1 parent bb5509e commit 2d61cab
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 38 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ Additional Commands:
version Print the version number of Globalping CLI

Flags:
-C, --ci Disable realtime terminal updates and color suitable for CI and scripting (default false)
-F, --from string Comma-separated list of location values to match against or a measurement ID
For example, the partial or full name of a continent, region (e.g eastern europe), country, US state, city or network
Or use [@1 | first, @2 ... @-2, @-1 | last | previous] to run with the probes from previous measurements. (default "world")
-h, --help help for globalping
-J, --json Output results in JSON format (default false)
--latency Output only the stats of a measurement (default false). Only applies to the dns, http and ping commands
-L, --limit int Limit the number of probes to use (default 1)

Use "globalping [command] --help" for more information about a command.
```
Expand Down
6 changes: 0 additions & 6 deletions cmd/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ Using the dig format @resolver. For example:

// dns specific flags
flags := dnsCmd.Flags()
flags.StringVarP(&r.ctx.From, "from", "F", r.ctx.From, fromShortDesc)
flags.IntVarP(&r.ctx.Limit, "limit", "L", r.ctx.Limit, limitShortDesc)
flags.BoolVarP(&r.ctx.ToJSON, "json", "J", r.ctx.ToJSON, jsonShortDesc)
flags.BoolVarP(&r.ctx.CIMode, "ci", "C", r.ctx.CIMode, ciModeShortDesc)
flags.BoolVar(&r.ctx.ToLatency, "latency", r.ctx.ToLatency, latencyShortDesc)
flags.BoolVar(&r.ctx.Share, "share", r.ctx.Share, shareShortDesc)
flags.StringVar(&r.ctx.Protocol, "protocol", r.ctx.Protocol, "Specifies the protocol to use for the DNS query (TCP or UDP) (default \"udp\")")
flags.IntVar(&r.ctx.Port, "port", r.ctx.Port, "Send the query to a non-standard port on the server (default 53)")
flags.StringVar(&r.ctx.Resolver, "resolver", r.ctx.Resolver, "Resolver is the hostname or IP address of the name server to use (default empty)")
Expand Down
6 changes: 0 additions & 6 deletions cmd/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ Examples:

// http specific flags
flags := httpCmd.Flags()
flags.StringVarP(&r.ctx.From, "from", "F", r.ctx.From, fromShortDesc)
flags.IntVarP(&r.ctx.Limit, "limit", "L", r.ctx.Limit, limitShortDesc)
flags.BoolVarP(&r.ctx.ToJSON, "json", "J", r.ctx.ToJSON, jsonShortDesc)
flags.BoolVarP(&r.ctx.CIMode, "ci", "C", r.ctx.CIMode, ciModeShortDesc)
flags.BoolVar(&r.ctx.ToLatency, "latency", r.ctx.ToLatency, latencyShortDesc)
flags.BoolVar(&r.ctx.Share, "share", r.ctx.Share, shareShortDesc)
flags.StringVar(&r.ctx.Protocol, "protocol", r.ctx.Protocol, "Specifies the query protocol (HTTP, HTTPS, HTTP2) (default \"HTTP\")")
flags.IntVar(&r.ctx.Port, "port", r.ctx.Port, "Specifies the port to use (default 80 for HTTP, 443 for HTTPS and HTTP2)")
flags.StringVar(&r.ctx.Resolver, "resolver", r.ctx.Resolver, "Specifies the resolver server used for DNS lookup (default is defined by the probe's network)")
Expand Down
5 changes: 0 additions & 5 deletions cmd/mtr.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ Examples:

// mtr specific flags
flags := mtrCmd.Flags()
flags.StringVarP(&r.ctx.From, "from", "F", r.ctx.From, fromShortDesc)
flags.IntVarP(&r.ctx.Limit, "limit", "L", r.ctx.Limit, limitShortDesc)
flags.BoolVarP(&r.ctx.ToJSON, "json", "J", r.ctx.ToJSON, jsonShortDesc)
flags.BoolVarP(&r.ctx.CIMode, "ci", "C", r.ctx.CIMode, ciModeShortDesc)
flags.BoolVar(&r.ctx.Share, "share", r.ctx.Share, shareShortDesc)
flags.StringVar(&r.ctx.Protocol, "protocol", r.ctx.Protocol, "Specifies the protocol used (ICMP, TCP or UDP) (default \"icmp\")")
flags.IntVar(&r.ctx.Port, "port", r.ctx.Port, "Specifies the port to use. Only applicable for TCP protocol (default 53)")
flags.IntVar(&r.ctx.Packets, "packets", r.ctx.Packets, "Specifies the number of packets to send to each hop (default 3)")
Expand Down
6 changes: 0 additions & 6 deletions cmd/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ Examples:

// ping specific flags
flags := pingCmd.Flags()
flags.StringVarP(&r.ctx.From, "from", "F", r.ctx.From, fromShortDesc)
flags.IntVarP(&r.ctx.Limit, "limit", "L", r.ctx.Limit, limitShortDesc)
flags.BoolVarP(&r.ctx.ToJSON, "json", "J", r.ctx.ToJSON, jsonShortDesc)
flags.BoolVarP(&r.ctx.CIMode, "ci", "C", r.ctx.CIMode, ciModeShortDesc)
flags.BoolVar(&r.ctx.ToLatency, "latency", r.ctx.ToLatency, latencyShortDesc)
flags.BoolVar(&r.ctx.Share, "share", r.ctx.Share, shareShortDesc)
flags.IntVar(&r.ctx.Packets, "packets", r.ctx.Packets, "Specifies the desired amount of ECHO_REQUEST packets to be sent (default 3)")
flags.BoolVar(&r.ctx.Infinite, "infinite", r.ctx.Infinite, "Keep pinging the target continuously until stopped (default false)")

Expand Down
19 changes: 10 additions & 9 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@ import (
"github.com/spf13/cobra"
)

var fromShortDesc = `Comma-separated list of location values to match against or a measurement ID
For example, the partial or full name of a continent, region (e.g eastern europe), country, US state, city or network
Or use [@1 | first, @2 ... @-2, @-1 | last | previous] to run with the probes from previous measurements.`
var limitShortDesc = `Limit the number of probes to use`
var jsonShortDesc = `Output results in JSON format (default false)`
var ciModeShortDesc = `Disable realtime terminal updates and color suitable for CI and scripting (default false)`
var latencyShortDesc = `Output only the stats of a measurement (default false)`
var shareShortDesc = `Prints a link at the end the results, allowing to vizualize the results online (default false)`

type Root struct {
printer *view.Printer
ctx *view.Context
Expand Down Expand Up @@ -85,6 +76,16 @@ The CLI tool allows you to interact with the API in a simple and human-friendly

root.Cmd.SetOut(printer.OutWriter)
root.Cmd.SetErr(printer.ErrWriter)
// Global flags
flags := root.Cmd.PersistentFlags()
flags.StringVarP(&ctx.From, "from", "F", ctx.From, `Comma-separated list of location values to match against or a measurement ID
For example, the partial or full name of a continent, region (e.g eastern europe), country, US state, city or network
Or use [@1 | first, @2 ... @-2, @-1 | last | previous] to run with the probes from previous measurements.`)
flags.IntVarP(&ctx.Limit, "limit", "L", ctx.Limit, "Limit the number of probes to use")
flags.BoolVarP(&ctx.ToJSON, "json", "J", ctx.ToJSON, "Output results in JSON format (default false)")
flags.BoolVarP(&ctx.CIMode, "ci", "C", ctx.CIMode, "Disable realtime terminal updates and color suitable for CI and scripting (default false)")
flags.BoolVar(&ctx.ToLatency, "latency", ctx.ToLatency, "Output only the stats of a measurement (default false). Only applies to the dns, http and ping commands")
flags.BoolVar(&ctx.Share, "share", ctx.Share, "Prints a link at the end the results, allowing to vizualize the results online (default false)")

root.Cmd.AddGroup(&cobra.Group{ID: "Measurements", Title: "Measurement Commands:"})

Expand Down
6 changes: 0 additions & 6 deletions cmd/traceroute.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ Examples:

// traceroute specific flags
flags := tracerouteCmd.Flags()
flags.StringVarP(&r.ctx.From, "from", "F", r.ctx.From, fromShortDesc)
flags.IntVarP(&r.ctx.Limit, "limit", "L", r.ctx.Limit, limitShortDesc)
flags.BoolVarP(&r.ctx.ToJSON, "json", "J", r.ctx.ToJSON, jsonShortDesc)
flags.BoolVarP(&r.ctx.CIMode, "ci", "C", r.ctx.CIMode, ciModeShortDesc)
flags.BoolVar(&r.ctx.ToLatency, "latency", r.ctx.ToLatency, latencyShortDesc)
flags.BoolVar(&r.ctx.Share, "share", r.ctx.Share, shareShortDesc)
flags.StringVar(&r.ctx.Protocol, "protocol", r.ctx.Protocol, "Specifies the protocol used for tracerouting (ICMP, TCP or UDP) (default \"icmp\")")
flags.IntVar(&r.ctx.Port, "port", r.ctx.Port, "Specifies the port to use for the traceroute. Only applicable for TCP protocol (default 80)")

Expand Down

0 comments on commit 2d61cab

Please sign in to comment.