Implemented basic path util.

This commit is contained in:
Andrey Parhomenko 2023-01-27 21:23:11 +05:00
parent aac4f7f5cd
commit 82ccc253d2
2 changed files with 14 additions and 0 deletions

View file

@ -25,6 +25,7 @@ import(
"github.com/surdeus/goblin/src/tool/grange" "github.com/surdeus/goblin/src/tool/grange"
"github.com/surdeus/goblin/src/tool/in" "github.com/surdeus/goblin/src/tool/in"
"github.com/surdeus/goblin/src/tool/useprog" "github.com/surdeus/goblin/src/tool/useprog"
"github.com/surdeus/goblin/src/tool/path"
) )
func main() { func main() {
@ -52,6 +53,7 @@ func main() {
"range" : mtool.Tool{grange.Run, "too lazy"}, "range" : mtool.Tool{grange.Run, "too lazy"},
"in" : mtool.Tool{in.Run, "filter strings from stdin that aren not in arguments"}, "in" : mtool.Tool{in.Run, "filter strings from stdin that aren not in arguments"},
"useprog" : mtool.Tool{useprog.Run, "print the name of the first existing program in arg list"}, "useprog" : mtool.Tool{useprog.Run, "print the name of the first existing program in arg list"},
"path" : mtool.Tool{path.Run, "print cross platform path based on cmd arguments"},
} }
mtool.Main("goblin", tools) mtool.Main("goblin", tools)

12
src/tool/path/main.go Normal file
View file

@ -0,0 +1,12 @@
package path
import (
"path/filepath"
"fmt"
)
func Run(args []string) {
path := filepath.Join(args[1:]...)
fmt.Print(path)
}