MCPcopy Index your code
hub / github.com/bitfield/script / Basename

Method Basename

script.go:215–217  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

213// slashes are removed. The behaviour of Basename is the same as
214// [filepath.Base] (not by coincidence).
215func (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.
220func (p *Pipe) Bytes() ([]byte, error) {

Calls 1

FilterLineMethod · 0.95