command

package module
v0.1.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dirname

func Dirname(_ ...any) gloo.Command[[]byte, []byte]

Dirname returns a Command that strips the final component from each input path, equivalent to the Unix dirname(1) utility.

It matches GNU dirname's pure string semantics: trailing separators are removed, the last component is dropped, and remaining trailing separators are removed. Interior separators are preserved and "." / ".." are not resolved, so "a//b//c" yields "a//b" and "/foo/.." yields "/foo".

Example
package main

import (
	"fmt"

	"github.com/gloo-foo/testable"

	command "github.com/gloo-foo/cmd-dirname"
)

func main() {
	lines, _ := testable.TestLines(command.Dirname(), "/usr/local/bin/script.sh\n/var/log/app.log\n")
	for _, line := range lines {
		fmt.Println(line)
	}
}
Output:
/usr/local/bin
/var/log
Example (FilenameOnly)
package main

import (
	"fmt"

	"github.com/gloo-foo/testable"

	command "github.com/gloo-foo/cmd-dirname"
)

func main() {
	lines, _ := testable.TestLines(command.Dirname(), "filename\n")
	for _, line := range lines {
		fmt.Println(line)
	}
}
Output:
.

Types

This section is empty.

Directories

Path Synopsis
Package alias provides an unprefixed name for the dirname command.
Package alias provides an unprefixed name for the dirname command.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址