Skip to content

Commit

Permalink
add exec -L flag.
Browse files Browse the repository at this point in the history
`-L x:y:z` is equivalent to `--local-port x --host y --port z`.
  • Loading branch information
fujiwara committed Apr 19, 2024
1 parent 8354418 commit b2a5791
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ Flags:
--local-port=0 local port number
--port=0 remote port number (required for --port-forward)
--host= remote host (required for --port-forward)
-L short expression of local-port:host:port
```

If `--id` is not set, the command shows a list of tasks to select a task to execute.
Expand All @@ -770,6 +771,12 @@ If `--id` is not set, the command shows a list of tasks to select a task to forw

When `--local-port` is not specified, use the ephemeral port for local port.

`-L` option is a short expression of `local-port:host:port`. For example, `-L 8080:example.com:80` is equivalent to `--local-port 8080 --host example.com --port 80`.

```
$ ecspresso exec --port-forward -L 8080:example.com:80
```

## Plugins

ecspresso has some plugins to extend template functions.
Expand Down
2 changes: 2 additions & 0 deletions exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type ExecOption struct {
LocalPort int `help:"local port number" default:"0"`
Port int `help:"remote port number (required for --port-forward)" default:"0"`
Host string `help:"remote host (required for --port-forward)" default:""`
L string `name:"L" short:"L" help:"short expression of local-port:host:port" default:""`
}

func (d *App) NewEcsta(ctx context.Context) (*ecsta.Ecsta, error) {
Expand Down Expand Up @@ -52,6 +53,7 @@ func (d *App) Exec(ctx context.Context, opt ExecOption) error {
LocalPort: opt.LocalPort,
RemotePort: opt.Port,
RemoteHost: opt.Host,
L: opt.L,
Family: &family,
Service: service,
})
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/aws/smithy-go v1.19.0
github.com/fatih/color v1.16.0
github.com/fujiwara/cfn-lookup v1.0.0
github.com/fujiwara/ecsta v0.4.3
github.com/fujiwara/ecsta v0.4.5
github.com/fujiwara/logutils v1.1.2
github.com/fujiwara/tfstate-lookup v1.1.6
github.com/goccy/go-yaml v1.9.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/fujiwara/cfn-lookup v1.0.0 h1:oDhBXaEvT27B0dFB4z3zbjuTzA3E6m8t8Sge9mffAzU=
github.com/fujiwara/cfn-lookup v1.0.0/go.mod h1:HI8F4hlW+nN9KRTWNzdwvnOUQFrN8jX9puyfhtAVgwU=
github.com/fujiwara/ecsta v0.4.3 h1:1T/GDB8qgD2uE2vSVGtWgIPgglXl/WfQEBN/1Wl5rk4=
github.com/fujiwara/ecsta v0.4.3/go.mod h1:SwSlCJuhiVrWfpYSaaHUSZVrs6Ey6nJ9V3flWNX7ndk=
github.com/fujiwara/ecsta v0.4.5 h1:82M3oL6n+eNd3JgPiFOOKkIYq46ggnts2HbuHOtX3rI=
github.com/fujiwara/ecsta v0.4.5/go.mod h1:SwSlCJuhiVrWfpYSaaHUSZVrs6Ey6nJ9V3flWNX7ndk=
github.com/fujiwara/logutils v1.1.2 h1:nYVRyTj+5SyCvpZUrYIZU4kubqNycGTxFXMKJBKe0Sg=
github.com/fujiwara/logutils v1.1.2/go.mod h1:pdb/Uk70rjQWEmFm/OvYH7OG8meZt1fEIqC0qZbvro4=
github.com/fujiwara/tfstate-lookup v1.1.6 h1:IFWGCpJ/mhK0OkWiBGd/0kIgjwE/H6eh9BobLptkebo=
Expand Down

0 comments on commit b2a5791

Please sign in to comment.