about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-06-20 14:54:29 -0700
committerFranck Cuny <franck@fcuny.net>2022-06-20 14:57:31 -0700
commitd72a81d21148c44f9e3e38451e7017b94f8b2327 (patch)
tree6eb479f19c9210832c0cfac461eb9dbdbab20d04 /tools
parentfeat(home/shell): add aliases for ip2int and int2ip (diff)
downloadworld-d72a81d21148c44f9e3e38451e7017b94f8b2327.tar.gz
fix(tools/ipconverter): fail if number of arguments is insufficient
Change-Id: Ifa382713e3f7cf2360b58d6c05a8a200258921f2
Reviewed-on: https://cl.fcuny.net/c/world/+/464
Tested-by: CI
Reviewed-by: Franck Cuny <franck@fcuny.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/ipconverter/main.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/ipconverter/main.go b/tools/ipconverter/main.go
index 1211970..e0893a1 100644
--- a/tools/ipconverter/main.go
+++ b/tools/ipconverter/main.go
@@ -11,6 +11,11 @@ import (
 )
 
 func main() {
+	if len(os.Args) < 2 {
+		fmt.Fprintf(os.Stderr, "usage: %s <ip2int|int2ip> <values>\n", os.Args[0])
+		os.Exit(1)
+	}
+
 	cmd := path.Base(os.Args[1])
 
 	switch cmd {