Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gp-cli] Add alias for forward and await in ports #10538

Merged
merged 2 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

var awaitPortCmd = &cobra.Command{
Use: "await-port <port>",
Use: "await <port>",
Short: "Waits for a process to listen on a port",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
Expand Down Expand Up @@ -54,6 +54,18 @@ var awaitPortCmd = &cobra.Command{
},
}

var awaitPortCmdAlias = &cobra.Command{
Hidden: true,
Deprecated: "please use `ports await` instead.",
Use: "await-port <port>",
Short: awaitPortCmd.Short,
Long: awaitPortCmd.Long,
Args: awaitPortCmd.Args,
Run: awaitPortCmd.Run,
}

func init() {
rootCmd.AddCommand(awaitPortCmd)
portsCmd.AddCommand(awaitPortCmd)

rootCmd.AddCommand(awaitPortCmdAlias)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (

var rewriteHostHeader bool

var portFwdCmd = &cobra.Command{
Use: "forward-port <local-port> [target-port]",
var portExposeCmd = &cobra.Command{
Use: "expose <local-port> [target-port]",
Short: "Makes a port available on 0.0.0.0 so that it can be exposed to the internet",
Long: ``,
Args: cobra.RangeArgs(1, 2),
Expand Down Expand Up @@ -71,7 +71,20 @@ var portFwdCmd = &cobra.Command{
},
}

var portExposeCmdAlias = &cobra.Command{
Hidden: true,
Deprecated: "please use `ports expose` instead.",
Use: "forward-port <local-port> [target-port]",
Short: portExposeCmd.Short,
Long: portExposeCmd.Long,
Args: portExposeCmd.Args,
Run: portExposeCmd.Run,
}

func init() {
rootCmd.AddCommand(portFwdCmd)
portFwdCmd.Flags().BoolVarP(&rewriteHostHeader, "rewrite-host-header", "r", false, "rewrites the host header of passing HTTP requests to localhost")
portsCmd.AddCommand(portExposeCmd)
portExposeCmd.Flags().BoolVarP(&rewriteHostHeader, "rewrite-host-header", "r", false, "rewrites the host header of passing HTTP requests to localhost")

rootCmd.AddCommand(portExposeCmdAlias)
portExposeCmdAlias.Flags().BoolVarP(&rewriteHostHeader, "rewrite-host-header", "r", false, "rewrites the host header of passing HTTP requests to localhost")
}