Skip to content

Commit

Permalink
update cobra dependency
Browse files Browse the repository at this point in the history
add fish to completion
make probing the default
  • Loading branch information
oncilla committed Apr 21, 2020
1 parent 48a3c9b commit ee85d9a
Show file tree
Hide file tree
Showing 7 changed files with 443 additions and 30 deletions.
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ require (
github.com/google/gopacket v1.1.16-0.20190123011826-102d5ca2098c
github.com/iancoleman/strcase v0.0.0-20190422225806-e506e3ef7365
github.com/inconshreveable/log15 v0.0.0-20161013181240-944cbfb97b44
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/kormat/fmt15 v0.0.0-20181112140556-ee69fecb2656
github.com/lucas-clemente/quic-go v0.7.1-0.20190212114006-fd7246d7ed6e
github.com/marten-seemann/qtls v0.0.0-20190207043627-591c71538704 // indirect
Expand All @@ -32,8 +31,7 @@ require (
github.com/sergi/go-diff v1.0.1-0.20180205163309-da645544ed44
github.com/smartystreets/goconvey v1.6.4
github.com/songgao/water v0.0.0-20190725173103-fd331bda3f4b
github.com/spf13/cobra v0.0.3-0.20180408161736-cd30c2a7e91a
github.com/spf13/pflag v1.0.1-0.20180403115518-1ce0cc6db402 // indirect
github.com/spf13/cobra v1.0.0
github.com/stretchr/testify v1.3.1-0.20190311161405-34c6fa2dc709
github.com/syndtr/gocapability v0.0.0-20160928074757-e7cb7fa329f4
github.com/uber/jaeger-client-go v2.20.1+incompatible
Expand Down
92 changes: 85 additions & 7 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions go/pkg/showpaths/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ type Config struct {
MaxPaths int
// Refresh configures whether sciond is queried with the refresh flag.
Refresh bool
// Probe configures whether the path status is probed and displayed.
Probe bool
// NoProbe configures whether the path status is probed or not.
NoProbe bool
}
2 changes: 1 addition & 1 deletion go/pkg/showpaths/showpaths.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func Run(ctx context.Context, dst addr.IA, cfg Config) (*Result, error) {

var statuses map[string]pathprobe.Status
var localIP net.IP
if cfg.Probe {
if !cfg.NoProbe {
// Resolve local IP in case it is not configured.
if localIP = cfg.Local; localIP == nil {
localIP, err = findDefaultLocalIP(ctx, sdConn)
Expand Down
4 changes: 3 additions & 1 deletion go/scion/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ To permanently add bash autocompletion, run:
return rootCmd.GenBashCompletion(os.Stdout)
case "zsh":
return rootCmd.GenZshCompletion(os.Stdout)
case "fish":
return rootCmd.GenFishCompletion(os.Stdout, true)
default:
return serrors.New("unknown shell", "input", completionShell)
}
Expand All @@ -52,5 +54,5 @@ To permanently add bash autocompletion, run:
func init() {
rootCmd.AddCommand(completionCmd)
completionCmd.Flags().StringVar(&completionShell, "shell", "bash",
"Shell type (bash|zsh)")
"Shell type (bash|zsh|fish)")
}
15 changes: 7 additions & 8 deletions go/scion/showpaths.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ var showpathsCmd = &cobra.Command{
Short: "Display paths to a SCION AS",
Aliases: []string{"sp"},
Args: cobra.ExactArgs(1),
Example: ` scion showpaths 1-ff00:0:110 --probe --expiration
scion showpaths 1-ff00:0:110 --probe --json
scion showpaths 1-ff00:0:110 --local 127.0.0.55`,
Example: ` scion showpaths 1-ff00:0:110 --expiration
scion showpaths 1-ff00:0:110 --local 127.0.0.55 --json
scion showpaths 1-ff00:0:110 --no-probe`,
Long: `'showpaths' lists available paths between the local and the specified SCION ASe a.
By default, the paths are not probed. As paths might be served from the SCION Deamon's
cache, they might not forward traffic successfully (e.g. if a network link went down).
To list the paths with their health statuses, specify that the paths should be probed
through the flag.
By default, the paths are probed. Paths served from the SCION Deamon's might not
forward traffic successfully (e.g. if a network link went down, or there is a black
hole on the path). To disable path probing, set the appropriate flag.
'showpaths' can be instructed to output the paths as json using the the --json flag.
`,
Expand Down Expand Up @@ -93,7 +92,7 @@ func init() {
"Show path expiration information")
showpathsCmd.Flags().BoolVarP(&showpathsFlags.cfg.Refresh, "refresh", "r", false,
"Set refresh flag for SCION Deamon path request")
showpathsCmd.Flags().BoolVarP(&showpathsFlags.cfg.Probe, "probe", "p", false,
showpathsCmd.Flags().BoolVarP(&showpathsFlags.cfg.NoProbe, "no-probe", "p", false,
"Probe the paths and print the health status")
showpathsCmd.Flags().BoolVarP(&showpathsFlags.json, "json", "j", false,
"Write the output as machine readable json")
Expand Down
Loading

0 comments on commit ee85d9a

Please sign in to comment.