Skip to content

Commit

Permalink
update text format for better consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
inventarSarah committed Jun 17, 2024
1 parent f336bc4 commit d655800
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 39 deletions.
12 changes: 6 additions & 6 deletions cmd/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func (r *Root) initDNS() {
RunE: r.RunDNS,
Use: "dns [target] from [location | measurement ID | @1 | first | @-1 | last | previous]",
GroupID: "Measurements",
Short: "Resolve DNS records, similar to the dig command.",
Short: "Resolve DNS records, similar to the dig command",
Long: `The dns command (similar to the "dig" command) performs DNS lookups and displays the responses from the queried name servers, helping you troubleshoot DNS-related issues.
Note that a probe's local settings or DHCP determine the default nameserver the command uses. To specify a DNS resolver, use the --resolver argument or @resolver format:
- dns jsdelivr.com from Berlin --resolver 1.1.1.1
Expand Down Expand Up @@ -54,11 +54,11 @@ Note that a probe's local settings or DHCP determine the default nameserver the

// dns specific flags
flags := dnsCmd.Flags()
flags.StringVar(&r.ctx.Protocol, "protocol", r.ctx.Protocol, "Specify the protocol to use for the DNS query: TCP or UDP. (default \"udp\")")
flags.IntVar(&r.ctx.Port, "port", r.ctx.Port, "Specify a non-standard port on the server to send the query to. (default 53)")
flags.StringVar(&r.ctx.Resolver, "resolver", r.ctx.Resolver, "Specify the hostname or IP address of the name server to use as the resolver. (default defined by the probe)")
flags.StringVar(&r.ctx.QueryType, "type", r.ctx.QueryType, "Specify the type of DNS query to perform. (default \"A\")")
flags.BoolVar(&r.ctx.Trace, "trace", r.ctx.Trace, "Enable tracing of the delegation path from the root name servers. (default false)")
flags.StringVar(&r.ctx.Protocol, "protocol", r.ctx.Protocol, "specify the protocol to use for the DNS query: TCP or UDP (default \"udp\")")
flags.IntVar(&r.ctx.Port, "port", r.ctx.Port, "specify a non-standard port on the server to send the query to (default 53)")
flags.StringVar(&r.ctx.Resolver, "resolver", r.ctx.Resolver, "specify the hostname or IP address of the name server to use as the resolver (default defined by the probe)")
flags.StringVar(&r.ctx.QueryType, "type", r.ctx.QueryType, "specify the type of DNS query to perform (default \"A\")")
flags.BoolVar(&r.ctx.Trace, "trace", r.ctx.Trace, "enable tracing of the delegation path from the root name servers (default false)")

r.Cmd.AddCommand(dnsCmd)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (r *Root) initHistory() {
historyCmd := &cobra.Command{
Run: r.RunHistory,
Use: "history",
Short: "Display the measurement history of your current session.",
Short: "Display the measurement history of your current session",
Long: `Display the measurement history of your current session.
Examples:
# Display all measurements of the current session.
Expand All @@ -48,8 +48,8 @@ Examples:
}

flags := historyCmd.Flags()
flags.UintVar(&r.ctx.Head, "head", r.ctx.Head, "Specify the number of measurements to display from the beginning of the history.")
flags.UintVar(&r.ctx.Tail, "tail", r.ctx.Tail, "Specify the number of measurements to display from the end of the history.")
flags.UintVar(&r.ctx.Head, "head", r.ctx.Head, "specify the number of measurements to display from the beginning of the history")
flags.UintVar(&r.ctx.Tail, "tail", r.ctx.Tail, "specify the number of measurements to display from the end of the history")

r.Cmd.AddCommand(historyCmd)
}
Expand Down
20 changes: 10 additions & 10 deletions cmd/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (r *Root) initHTTP() {
RunE: r.RunHTTP,
Use: "http [target] from [location | measurement ID | @1 | first | @-1 | last | previous]",
GroupID: "Measurements",
Short: "Perform a HEAD or GET request to a host.",
Short: "Perform a HEAD or GET request to a host",
Long: `The http command sends an HTTP request to a host and can perform either HEAD or GET operations, returning detailed performance statistics for each request. Use it to test and assess the performance and availability of your website, API, or other web services.
Note that GET responses are limited to 10KB, with anything beyond this cut by the API.
Expand Down Expand Up @@ -69,15 +69,15 @@ Examples:

// http specific flags
flags := httpCmd.Flags()
flags.StringVar(&r.ctx.Protocol, "protocol", r.ctx.Protocol, "Specify the protocol to use: HTTP, HTTPS, or HTTP2. (default \"HTTP\")")
flags.IntVar(&r.ctx.Port, "port", r.ctx.Port, "Specify the port to use. (default 80 for HTTP, 443 for HTTPS and HTTP2)")
flags.StringVar(&r.ctx.Resolver, "resolver", r.ctx.Resolver, "Specify the hostname or IP address of the name server to use for the DNS lookup. (default defined by the probe)")
flags.StringVar(&r.ctx.Host, "host", r.ctx.Host, "Specify the Host header to add to the request. (default host's defined in command target)")
flags.StringVar(&r.ctx.Path, "path", r.ctx.Path, "Specify the URL pathname. (default \"/\")")
flags.StringVar(&r.ctx.Query, "query", r.ctx.Query, "Specify a query string to add.")
flags.StringVar(&r.ctx.Method, "method", r.ctx.Method, "Specify the HTTP method to use: HEAD or GET. (default \"HEAD\")")
flags.StringArrayVarP(&r.ctx.Headers, "header", "H", r.ctx.Headers, "Specify an HTTP header to add to the request in the format \"Key: Value\". You can add multiple headers by providing the flag for each one separately.")
flags.BoolVar(&r.ctx.Full, "full", r.ctx.Full, "Enable full output when performing an HTTP GET request to display the status, headers, and body.")
flags.StringVar(&r.ctx.Protocol, "protocol", r.ctx.Protocol, "specify the protocol to use: HTTP, HTTPS, or HTTP2 (default \"HTTP\")")
flags.IntVar(&r.ctx.Port, "port", r.ctx.Port, "specify the port to use (default 80 for HTTP, 443 for HTTPS and HTTP2)")
flags.StringVar(&r.ctx.Resolver, "resolver", r.ctx.Resolver, "specify the hostname or IP address of the name server to use for the DNS lookup (default defined by the probe)")
flags.StringVar(&r.ctx.Host, "host", r.ctx.Host, "specify the Host header to add to the request (default host's defined in command target)")
flags.StringVar(&r.ctx.Path, "path", r.ctx.Path, "specify the URL pathname (default \"/\")")
flags.StringVar(&r.ctx.Query, "query", r.ctx.Query, "specify a query string to add")
flags.StringVar(&r.ctx.Method, "method", r.ctx.Method, "specify the HTTP method to use: HEAD or GET (default \"HEAD\")")
flags.StringArrayVarP(&r.ctx.Headers, "header", "H", r.ctx.Headers, "add HTTP headers to the request in the format \"Key: Value\"; to add multiple headers, define the flag for each one separately")
flags.BoolVar(&r.ctx.Full, "full", r.ctx.Full, "enable full output when performing an HTTP GET request to display the status, headers, and body")

r.Cmd.AddCommand(httpCmd)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/install_probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func (r *Root) initInstallProbe() {
installProbeCmd := &cobra.Command{
Use: "install-probe",
Short: "Join the community-powered Globalping network by running a probe in a Docker container.",
Short: "Join the community-powered Globalping network by running a probe in a Docker container",
Long: `The install-probe command downloads and runs the Globalping probe in a Docker container on your machine. Requires you to have Docker installed.`,
Run: r.RunInstallProbe,
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/mtr.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func (r *Root) initMTR() {
RunE: r.RunMTR,
Use: "mtr [target] from [location | measurement ID | @1 | first | @-1 | last | previous]",
GroupID: "Measurements",
Short: "Run a MTR test, which combines traceroute and ping.",
Short: "Run a MTR test, which combines traceroute and ping",
Long: `The MTR command combines the functionalities of traceroute and ping, providing real-time insights into the sent packets' routes. Use it to diagnose network issues such as packet loss, latency, and route instability.
Examples:
Expand Down Expand Up @@ -47,9 +47,9 @@ Examples:

// mtr specific flags
flags := mtrCmd.Flags()
flags.StringVar(&r.ctx.Protocol, "protocol", r.ctx.Protocol, "Specify the protocol to use for MTR: ICMP, TCP, or UDP. (default \"icmp\")")
flags.IntVar(&r.ctx.Port, "port", r.ctx.Port, "Specify the port to use for MTR. Only applicable for the TCP protocol. (default 53)")
flags.IntVar(&r.ctx.Packets, "packets", r.ctx.Packets, "Specify the number of packets to send to each hop. (default 3)")
flags.StringVar(&r.ctx.Protocol, "protocol", r.ctx.Protocol, "specify the protocol to use for MTR: ICMP, TCP, or UDP (default \"icmp\")")
flags.IntVar(&r.ctx.Port, "port", r.ctx.Port, "specify the port to use for MTR; only applicable for the TCP protocol (default 53)")
flags.IntVar(&r.ctx.Packets, "packets", r.ctx.Packets, "specify the number of packets to send to each hop (default 3)")

r.Cmd.AddCommand(mtrCmd)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func (r *Root) initPing() {
RunE: r.RunPing,
Use: "ping [target] from [location | measurement ID | @1 | first | @-1 | last | previous]",
GroupID: "Measurements",
Short: "Perform a ping test.",
Short: "Perform a ping test",
Long: `The ping command checks a target's reachability by sending small data packets. Use it to test network latency and stability, as well as obtain information about packet loss and round-trip times.
Examples:
Expand Down Expand Up @@ -52,8 +52,8 @@ Examples:

// ping specific flags
flags := pingCmd.Flags()
flags.IntVar(&r.ctx.Packets, "packets", r.ctx.Packets, "Specify the number of ECHO_REQUEST packets to send. (default 3)")
flags.BoolVar(&r.ctx.Infinite, "infinite", r.ctx.Infinite, "Enable continuous pinging of the target until manually stopped. (default false)")
flags.IntVar(&r.ctx.Packets, "packets", r.ctx.Packets, "specify the number of ECHO_REQUEST packets to send (default 3)")
flags.BoolVar(&r.ctx.Infinite, "infinite", r.ctx.Infinite, "enable continuous pinging of the target until manually stopped (default false)")

r.Cmd.AddCommand(pingCmd)
}
Expand Down
15 changes: 7 additions & 8 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func NewRoot(
// rootCmd represents the base command when called without any subcommands
root.Cmd = &cobra.Command{
Use: "globalping",
Short: "A global network of probes to perform network tests such as ping, traceroute, and DNS resolution.",
Short: "A global network of probes to perform network tests such as ping, traceroute, and DNS resolution",
Long: `The Globalping platform allows anyone to run networking commands such as ping, traceroute, dig, and mtr on probes distributed around the globe.
The CLI tool provides access to the Globalping API, enabling you to troubleshoot networking issues and script automated tests and benchmarks in a straightforward and user-friendly way.
For more information about the platform, tips, and best practices, visit our GitHub repository at https://github.com/jsdelivr/globalping.`,
Expand All @@ -78,13 +78,12 @@ For more information about the platform, tips, and best practices, visit our Git
root.Cmd.SetErr(printer.ErrWriter)
// Global flags
flags := root.Cmd.PersistentFlags()
flags.StringVarP(&ctx.From, "from", "F", ctx.From, `Specify the probe location by providing a comma-separated list of location values, such as continents, regions, countries, US states, cities, or networks.
Alternatively, use [@1 | first, @2 ... @-2, @-1 | last | previous] to run with the probes from your previous measurements. (default "world")`)
flags.IntVarP(&ctx.Limit, "limit", "L", ctx.Limit, "Define the number of probes to use. (default 1)")
flags.BoolVarP(&ctx.ToJSON, "json", "J", ctx.ToJSON, "Output results in JSON format. (default false)")
flags.BoolVarP(&ctx.CIMode, "ci", "C", ctx.CIMode, "Disable real-time 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; applicable only to dns, http, and ping commands. (default false)")
flags.BoolVar(&ctx.Share, "share", ctx.Share, "Print a link at the end of the results to visualize them online. (default false)")
flags.StringVarP(&ctx.From, "from", "F", ctx.From, `specify the probe location; provide a comma-separated list of location values, such as continents, regions, countries, US states, cities, or networks 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, "define 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 real-time 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; applicable only to dns, http, and ping commands (default false)")
flags.BoolVar(&ctx.Share, "share", ctx.Share, "print a link at the end of the results to visualize them online (default false)")

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

Expand Down
6 changes: 3 additions & 3 deletions cmd/traceroute.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func (r *Root) initTraceroute() {
RunE: r.RunTraceroute,
Use: "traceroute [target] from [location | measurement ID | @1 | first | @-1 | last | previous]",
GroupID: "Measurements",
Short: "Run a traceroute test.",
Short: "Run a traceroute test",
Long: `The traceroute command traces the path packets take to reach a target, displaying each hop along the way, including its round-trip time. Use it to troubleshoot network connectivity issues and identify latency problems.
Examples:
Expand Down Expand Up @@ -50,8 +50,8 @@ Examples:

// traceroute specific flags
flags := tracerouteCmd.Flags()
flags.StringVar(&r.ctx.Protocol, "protocol", r.ctx.Protocol, "Specify the protocol to use for tracerouting: ICMP, TCP, or UDP. (default \"icmp\")")
flags.IntVar(&r.ctx.Port, "port", r.ctx.Port, "Specify the port to use for the traceroute. Only applicable for the TCP protocol. (default 80)")
flags.StringVar(&r.ctx.Protocol, "protocol", r.ctx.Protocol, "specify the protocol to use for tracerouting: ICMP, TCP, or UDP (default \"icmp\")")
flags.IntVar(&r.ctx.Port, "port", r.ctx.Port, "specify the port to use for the traceroute; only applicable for the TCP protocol (default 80)")

r.Cmd.AddCommand(tracerouteCmd)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func (r *Root) initVersion() {
r.Cmd.AddCommand(&cobra.Command{
Run: r.RunVersion,
Use: "version",
Short: "Display the version number of your installed Globalping CLI.",
Short: "Display the version number of your installed Globalping CLI",
})
}

Expand Down

0 comments on commit d655800

Please sign in to comment.