diff --git a/src/cmd/goblin/main.go b/src/cmd/goblin/main.go index 747fe3e..838fa1f 100644 --- a/src/cmd/goblin/main.go +++ b/src/cmd/goblin/main.go @@ -25,6 +25,7 @@ import( "github.com/surdeus/goblin/src/tool/grange" "github.com/surdeus/goblin/src/tool/in" "github.com/surdeus/goblin/src/tool/useprog" + "github.com/surdeus/goblin/src/tool/path" ) func main() { @@ -52,6 +53,7 @@ func main() { "range" : mtool.Tool{grange.Run, "too lazy"}, "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"}, + "path" : mtool.Tool{path.Run, "print cross platform path based on cmd arguments"}, } mtool.Main("goblin", tools) diff --git a/src/tool/path/main.go b/src/tool/path/main.go new file mode 100644 index 0000000..d8629d4 --- /dev/null +++ b/src/tool/path/main.go @@ -0,0 +1,12 @@ +package path + +import ( + "path/filepath" + "fmt" +) + +func Run(args []string) { + path := filepath.Join(args[1:]...) + fmt.Print(path) +} +