From 51e2853f16e638b0268d7633f2a068dc5ed3fb6a Mon Sep 17 00:00:00 2001 From: surdeus Date: Wed, 28 Jun 2023 14:20:42 +0300 Subject: [PATCH] Check for the paths program. --- go.mod | 2 +- go.sum | 2 ++ src/tool/paths/main.go | 11 +++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 75637ac..b4edb6c 100644 --- a/go.mod +++ b/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 ) diff --git a/go.sum b/go.sum index 9c14523..12e26ae 100644 --- a/go.sum +++ b/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= diff --git a/src/tool/paths/main.go b/src/tool/paths/main.go index a2888d3..60f3032 100644 --- a/src/tool/paths/main.go +++ b/src/tool/paths/main.go @@ -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 {