Add dirname
This commit is contained in:
parent
0c61aa0694
commit
a2ea76179a
@ -11,3 +11,4 @@ Implemeted utilities:
|
|||||||
* `true`
|
* `true`
|
||||||
* `false`
|
* `false`
|
||||||
* `yes`
|
* `yes`
|
||||||
|
* `dirname`
|
||||||
|
20
dirname/dirname.go
Normal file
20
dirname/dirname.go
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
)
|
||||||
|
|
||||||
|
func usage() {
|
||||||
|
fmt.Printf("usage: %v path\n", os.Args[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if len(os.Args) != 2 {
|
||||||
|
usage()
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(path.Dir(os.Args[1]))
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user