From ba4507c02edf991b584535feaa828f3663e74bb6 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 9 Dec 2018 13:33:18 +0000 Subject: [PATCH 1/2] Update yggdrasilctl help (fixes #194) --- cmd/yggdrasilctl/main.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/cmd/yggdrasilctl/main.go b/cmd/yggdrasilctl/main.go index dcbde87a..ab8ee595 100644 --- a/cmd/yggdrasilctl/main.go +++ b/cmd/yggdrasilctl/main.go @@ -18,18 +18,26 @@ import ( type admin_info map[string]interface{} func main() { + flag.Usage = func() { + fmt.Fprintf(flag.CommandLine.Output(), "Usage: %s [options] command [key=value] [key=value] ...\n", os.Args[0]) + fmt.Println("Options:") + flag.PrintDefaults() + fmt.Println("Commands:\n - Use \"list\" for a list of available commands") + fmt.Println("Examples:") + fmt.Println(" - ", os.Args[0], "list") + fmt.Println(" - ", os.Args[0], "getPeers") + fmt.Println(" - ", os.Args[0], "setTunTap name=auto mtu=1500 tap_mode=false") + fmt.Println(" - ", os.Args[0], "-endpoint=tcp://localhost:9001 getDHT") + fmt.Println(" - ", os.Args[0], "-endpoint=unix:///var/run/ygg.sock getDHT") + } server := flag.String("endpoint", defaults.GetDefaults().DefaultAdminListen, "Admin socket endpoint") - injson := flag.Bool("json", false, "Output in JSON format") + injson := flag.Bool("json", false, "Output in JSON format (as opposed to pretty-print)") verbose := flag.Bool("v", false, "Verbose output (includes public keys)") flag.Parse() args := flag.Args() if len(args) == 0 { - fmt.Println("usage:", os.Args[0], "[-endpoint=proto://server] [-v] [-json] command [key=value] [...]") - fmt.Println("example:", os.Args[0], "getPeers") - fmt.Println("example:", os.Args[0], "setTunTap name=auto mtu=1500 tap_mode=false") - fmt.Println("example:", os.Args[0], "-endpoint=tcp://localhost:9001 getDHT") - fmt.Println("example:", os.Args[0], "-endpoint=unix:///var/run/ygg.sock getDHT") + flag.Usage() return } From e759fb1c3855a5e9d319c6f1ebc491f0a1bfd06e Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 9 Dec 2018 13:37:19 +0000 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc31b965..a073532f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Latency-based parent selection for the switch instead of uptime-based - Real peering endpoints now shown in the admin socket `getPeers` call - Reuse the multicast port on supported platforms so that multiple Yggdrasil processes can run +- `yggdrasilctl` now has more useful help text (with `-help` or when no arguments passed) ### Fixed - Memory leaks in the DHT fixed