Skip to content
Merged
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
23 changes: 4 additions & 19 deletions tool/tsh/common/tsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -1430,9 +1430,6 @@ func Run(ctx context.Context, args []string, opts ...CliOption) error {
case login.FullCommand():
err = onLogin(&cf)
case logout.FullCommand():
if err := refuseArgs(logout.FullCommand(), args); err != nil {
return trace.Wrap(err)
}
err = onLogout(&cf)
case show.FullCommand():
err = onShow(&cf)
Expand Down Expand Up @@ -2195,9 +2192,10 @@ func onLogout(cf *CLIConf) error {
}

fmt.Printf("Logged out all users from all proxies.\n")
default:
fmt.Printf("Specify --proxy and --user to remove keys for specific user ")
fmt.Printf("from a proxy or neither to log out all users from all proxies.\n")
case proxyHost != "" && cf.Username == "":
fmt.Printf("Specify --user to log out a specific user from %q or remove the --proxy flag to log out all users from all proxies.\n", proxyHost)
case proxyHost == "" && cf.Username != "":
fmt.Printf("Specify --proxy to log out user %q from a specific proxy or remove the --user flag to log out all users from all proxies.\n", cf.Username)
}
return nil
}
Expand Down Expand Up @@ -4346,19 +4344,6 @@ func parseCertificateCompatibilityFlag(compatibility string, certificateFormat s
}
}

// refuseArgs helper makes sure that 'args' (list of CLI arguments)
// does not contain anything other than command
func refuseArgs(command string, args []string) error {
for _, arg := range args {
if arg == command || strings.HasPrefix(arg, "-") {
continue
} else {
return trace.BadParameter("unexpected argument: %s", arg)
}
}
return nil
}

// flattenIdentity reads an identity file and flattens it into a tsh profile on disk.
func flattenIdentity(cf *CLIConf) error {
// Save the identity file path for later
Expand Down