()
| 105 | } |
| 106 | |
| 107 | func NewPipeCommand() *cli.Command { |
| 108 | cmd := &cli.Command{ |
| 109 | Name: "pipe", |
| 110 | HelpName: "pipe", |
| 111 | Usage: "stream to remote from stdin", |
| 112 | Flags: NewPipeCommandFlags(), |
| 113 | CustomHelpTemplate: pipeHelpTemplate, |
| 114 | Before: func(c *cli.Context) error { |
| 115 | err := validatePipeCommand(c) |
| 116 | if err != nil { |
| 117 | printError(commandFromContext(c), c.Command.Name, err) |
| 118 | } |
| 119 | return err |
| 120 | }, |
| 121 | Action: func(c *cli.Context) (err error) { |
| 122 | defer stat.Collect(c.Command.FullName(), &err)() |
| 123 | |
| 124 | pipe, err := NewPipe(c, false) |
| 125 | if err != nil { |
| 126 | return err |
| 127 | } |
| 128 | return pipe.Run(c.Context) |
| 129 | }, |
| 130 | } |
| 131 | |
| 132 | cmd.BashComplete = getBashCompleteFn(cmd, false, false) |
| 133 | return cmd |
| 134 | } |
| 135 | |
| 136 | // Pipe holds pipe operation flags and states. |
| 137 | type Pipe struct { |
no test coverage detected