Skip to content

Commit

Permalink
update README.md with cmd usage and change remote flag to optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed committed Feb 24, 2021
1 parent 2bad7f8 commit 1ed756e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
9 changes: 9 additions & 0 deletions README.md
Expand Up @@ -107,6 +107,15 @@ $ gossm scp -e '-i key.pem file user@server-domain:/home/blahblah'
# It is to execute a command("uptime") on selected multiple servers, waiting for a response on its result.
$ gossm cmd -e "uptime"
```

#### fwd
`-z` Optionally specify the remote port to access
`-l` Optionally specify the local port to forward (If not specified when using `-z`, then this value defaults to the value of `-z`)

```bash
$ gossm fwd -z 8080 -l 42069
```
If not specified, you will be prompted to enter a remote and local port after selecting a target.

**ex)**
<p align="center">
Expand Down
4 changes: 2 additions & 2 deletions cmd/forward.go
Expand Up @@ -77,12 +77,12 @@ var (

func init() {
// add sub command
fwdCommand.Flags().StringP("remote", "z", "", "[optional] remote port to forward to, ex) - 8080")
fwdCommand.Flags().StringP("local", "l", "", "[optional] local port to use, ex) \"-l 1234\"")
fwdCommand.Flags().StringP("remote", "z", "", "[required] remote port to forward to, ex) - 8080")

// mapping viper
viper.BindPFlag("local-port", fwdCommand.Flags().Lookup("local"))
viper.BindPFlag("remote-port", fwdCommand.Flags().Lookup("remote"))
viper.BindPFlag("local-port", fwdCommand.Flags().Lookup("local"))

rootCmd.AddCommand(fwdCommand)
}
1 change: 0 additions & 1 deletion go.mod
Expand Up @@ -9,7 +9,6 @@ require (
github.com/gobuffalo/packr/v2 v2.5.2
github.com/mitchellh/go-homedir v1.1.0
github.com/spf13/cobra v1.0.0
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.4.0
github.com/stretchr/testify v1.3.0
)
2 changes: 0 additions & 2 deletions go.sum
Expand Up @@ -147,8 +147,6 @@ github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU=
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
Expand Down

0 comments on commit 1ed756e

Please sign in to comment.