(cmd *cobra.Command, args []string)
| 22 | } |
| 23 | |
| 24 | func tokenCmdRun(cmd *cobra.Command, args []string) (rtnErr error) { |
| 25 | if len(args) != 2 { |
| 26 | OutputHelpMessage(cmd) |
| 27 | return fmt.Errorf("wsh token requires exactly 2 arguments, got %d", len(args)) |
| 28 | } |
| 29 | tokenStr, shellType := args[0], args[1] |
| 30 | if tokenStr == "" || shellType == "" { |
| 31 | OutputHelpMessage(cmd) |
| 32 | return fmt.Errorf("wsh token requires non-empty arguments") |
| 33 | } |
| 34 | rtnData, err := setupRpcClientWithToken(tokenStr) |
| 35 | if err != nil { |
| 36 | return fmt.Errorf("error setting up rpc client: %w", err) |
| 37 | } |
| 38 | envScriptText, err := shellutil.EncodeEnvVarsForShell(shellType, rtnData.Env) |
| 39 | if err != nil { |
| 40 | return fmt.Errorf("error encoding env vars: %w", err) |
| 41 | } |
| 42 | WriteStdout("%s\n", envScriptText) |
| 43 | WriteStdout("%s\n", rtnData.InitScriptText) |
| 44 | return nil |
| 45 | } |
nothing calls this directly
no test coverage detected