From d106f3a7c3da19981520c062a557ff76842125d9 Mon Sep 17 00:00:00 2001 From: surdeus Date: Fri, 24 Mar 2023 20:18:04 +0300 Subject: [PATCH] Fixed wrong link implementation. --- src/mtool/main.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mtool/main.go b/src/mtool/main.go index 3e58b38..94ee0fa 100644 --- a/src/mtool/main.go +++ b/src/mtool/main.go @@ -53,7 +53,7 @@ func Main(name string, m Tools) { binBase = binBase[:len(binBase)-len(path.Ext(binBase))] if binBase != name { utilName = binBase - args = os.Args[:] + args = os.Args } else { if len(os.Args)<2 { keys := make([]string, len(m)) @@ -82,8 +82,7 @@ func Main(name string, m Tools) { util := m[utilName] - arg1 := os.Args[1] - flagSet := flag.NewFlagSet(arg1, flag.ExitOnError) + flagSet := flag.NewFlagSet(utilName, flag.ExitOnError) flags := &Flags{ FlagSet : flagSet, } @@ -99,7 +98,7 @@ func Main(name string, m Tools) { fmt.Fprintf( out, "Usage of %s:\n\t%s", - arg1, arg1, + utilName, utilName, ) if hasOptions { fmt.Fprintf(out, " [options]") @@ -124,7 +123,7 @@ func Main(name string, m Tools) { } flags.progName = name - flags.utilName = args[0] + flags.utilName = utilName flags.args = args[1:] util.Handler(flags)