Merge pull request #1 from surdeus/use-new-parse
Check for the paths program.
This commit is contained in:
commit
ab3fb9e759
3 changed files with 8 additions and 7 deletions
2
go.mod
2
go.mod
|
@ -3,6 +3,6 @@ module github.com/mojosa-software/goblin
|
|||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/mojosa-software/gomtool v0.0.0-20230626085847-176486ff01a2
|
||||
github.com/mojosa-software/gomtool v0.0.0-20230628111258-73d5a2f1940f
|
||||
github.com/mojosa-software/goscript v0.0.0-20230626091305-86a004b7769c
|
||||
)
|
||||
|
|
2
go.sum
2
go.sum
|
@ -1,4 +1,6 @@
|
|||
github.com/mojosa-software/gomtool v0.0.0-20230626085847-176486ff01a2 h1:xbw1/w6ZB8xRmaTS0mQvfTETF8M2/tSBfHJIR+cJyNE=
|
||||
github.com/mojosa-software/gomtool v0.0.0-20230626085847-176486ff01a2/go.mod h1:cJ6/4rcQ/s22RTLuLtypFh7gubwG4OLSph3NHX3haAw=
|
||||
github.com/mojosa-software/gomtool v0.0.0-20230628111258-73d5a2f1940f h1:lsvXiy5XeOGCiOvkzuX0jA11jJf3j998Xes0/gmk50A=
|
||||
github.com/mojosa-software/gomtool v0.0.0-20230628111258-73d5a2f1940f/go.mod h1:cJ6/4rcQ/s22RTLuLtypFh7gubwG4OLSph3NHX3haAw=
|
||||
github.com/mojosa-software/goscript v0.0.0-20230626091305-86a004b7769c h1:y7RQZz/zJDARRJkn4szD8N2rK6K9NU1vUNPwahtW5zw=
|
||||
github.com/mojosa-software/goscript v0.0.0-20230626091305-86a004b7769c/go.mod h1:LtBn7lQTgA/TMEL8Y+dGkD6XWHV2gxRPZXiqCZt3HRc=
|
||||
|
|
|
@ -17,10 +17,10 @@ import (
|
|||
var (
|
||||
part string
|
||||
handlers = map[string]func(string) string{
|
||||
"base": path.Base,
|
||||
"ext": path.Ext,
|
||||
"dir": path.Dir,
|
||||
"all": func(v string) string { return v },
|
||||
"b": path.Base,
|
||||
"e": path.Ext,
|
||||
"d": path.Dir,
|
||||
"a": func(v string) string { return v },
|
||||
}
|
||||
handler func(string) string
|
||||
r bool
|
||||
|
@ -57,8 +57,7 @@ func Run(flags *mtool.Flags) {
|
|||
flags.BoolVar(&fromReal, "fr", false, "take input paths as real ones")
|
||||
flags.BoolVar(&ec, "ec", false, "escape characters (mostly for '\\' char in Git bash")
|
||||
|
||||
flags.Parse()
|
||||
args := flags.Args()
|
||||
args := flags.Parse()
|
||||
|
||||
lhandler, ok := handlers[part]
|
||||
if !ok {
|
||||
|
|
Loading…
Reference in a new issue