-
Notifications
You must be signed in to change notification settings - Fork 5
/
command_port.go
37 lines (32 loc) · 909 Bytes
/
command_port.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package vagrant
// PortCommand specifies the options and output of vagrant port.
type PortCommand struct {
BaseCommand
PortResponse
}
// Run vagrant port. After setting options as appropriate, you must call Run()
// or Start() followed by Wait() to execute. Output will be in ForwardedPorts
// with any error in Error.
func (client *VagrantClient) Port() *PortCommand {
return &PortCommand{
BaseCommand: newBaseCommand(client),
PortResponse: newPortResponse(),
}
}
func (cmd *PortCommand) init() error {
return cmd.BaseCommand.init(&cmd.PortResponse, "port")
}
// Run the command
func (cmd *PortCommand) Run() error {
if err := cmd.init(); err != nil {
return err
}
return cmd.BaseCommand.Run()
}
// Start the command. You must call Wait() to complete execution.
func (cmd *PortCommand) Start() error {
if err := cmd.init(); err != nil {
return err
}
return cmd.BaseCommand.Start()
}