Fixed wrong link implementation.

This commit is contained in:
Andrey Parhomenko 2023-03-24 20:18:04 +03:00
parent 3199e25c38
commit d106f3a7c3

View file

@ -53,7 +53,7 @@ func Main(name string, m Tools) {
binBase = binBase[:len(binBase)-len(path.Ext(binBase))] binBase = binBase[:len(binBase)-len(path.Ext(binBase))]
if binBase != name { if binBase != name {
utilName = binBase utilName = binBase
args = os.Args[:] args = os.Args
} else { } else {
if len(os.Args)<2 { if len(os.Args)<2 {
keys := make([]string, len(m)) keys := make([]string, len(m))
@ -82,8 +82,7 @@ func Main(name string, m Tools) {
util := m[utilName] util := m[utilName]
arg1 := os.Args[1] flagSet := flag.NewFlagSet(utilName, flag.ExitOnError)
flagSet := flag.NewFlagSet(arg1, flag.ExitOnError)
flags := &Flags{ flags := &Flags{
FlagSet : flagSet, FlagSet : flagSet,
} }
@ -99,7 +98,7 @@ func Main(name string, m Tools) {
fmt.Fprintf( fmt.Fprintf(
out, out,
"Usage of %s:\n\t%s", "Usage of %s:\n\t%s",
arg1, arg1, utilName, utilName,
) )
if hasOptions { if hasOptions {
fmt.Fprintf(out, " [options]") fmt.Fprintf(out, " [options]")
@ -124,7 +123,7 @@ func Main(name string, m Tools) {
} }
flags.progName = name flags.progName = name
flags.utilName = args[0] flags.utilName = utilName
flags.args = args[1:] flags.args = args[1:]
util.Handler(flags) util.Handler(flags)