Basename reads paths from the pipe, one per line, and removes any leading directory components from each. So, for example, /usr/local/bin/foo would become just foo. This is the complementary operation to [Pipe.Dirname]. If any line is empty, Basename will transform it to a single dot. Trailing slas
()
| 213 | // slashes are removed. The behaviour of Basename is the same as |
| 214 | // [filepath.Base] (not by coincidence). |
| 215 | func (p *Pipe) Basename() *Pipe { |
| 216 | return p.FilterLine(filepath.Base) |
| 217 | } |
| 218 | |
| 219 | // Bytes returns the contents of the pipe as a []byte, or an error. |
| 220 | func (p *Pipe) Bytes() ([]byte, error) { |