Skip to content

Commit

Permalink
Merge pull request #164 from Tenderly/beruda/spawn-rpc-patch
Browse files Browse the repository at this point in the history
Make `spawn-rpc` "return" url instead of logging/printing it
  • Loading branch information
beruda authored Oct 26, 2023
2 parents 1f5c29a + 6ce4be7 commit 0add238
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion commands/devnet/spawn_rpc.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package devnet

import (
"fmt"
"os"

"github.com/pkg/errors"
Expand All @@ -16,6 +17,7 @@ var projectSlug string
var templateSlug string
var accessKey string
var token string
var returnUrl bool

func init() {
cmdSpawnRpc.PersistentFlags().StringVar(
Expand Down Expand Up @@ -48,6 +50,12 @@ func init() {
"",
"The Tenderly JWT. If not provided, the system will try to read 'token' from the 'tenderly.yaml' configuration file.",
)
cmdSpawnRpc.PersistentFlags().BoolVar(
&returnUrl,
"return-url",
false,
"Optional flag to return the URL instead of printing it. Default: false.",
)
CmdDevNet.AddCommand(cmdSpawnRpc)
}

Expand Down Expand Up @@ -118,5 +126,10 @@ func spawnRPCHandler(cmd *cobra.Command, args []string) {
logrus.Error("Failed to spawn RPC", err)
return
}
logrus.Info(response)

if returnUrl {
fmt.Printf("%s\n", response)
} else {
logrus.Info(response)
}
}

0 comments on commit 0add238

Please sign in to comment.