git » chasquid » commit c9d3ba0

Add @domain to chasquid-util --help where appropriate

author Leandro Lucarella
2020-11-05 20:42:23 UTC
committer Alberto Bertogli
2020-11-12 23:24:21 UTC
parent bb1b921e3c626065e8e3980395136f3fbf808757

Add @domain to chasquid-util --help where appropriate

This makes it more clear how to specify which domain the user being
operated on is the sub-command targeting when using `--help`.

Amended-by: Alberto Bertogli <albertito@blitiri.com.ar>
  Update code to match the updated parameter name.

cmd/chasquid-util/chasquid-util.go +7 -7

diff --git a/cmd/chasquid-util/chasquid-util.go b/cmd/chasquid-util/chasquid-util.go
index f8eae2d..5b4aef7 100644
--- a/cmd/chasquid-util/chasquid-util.go
+++ b/cmd/chasquid-util/chasquid-util.go
@@ -29,9 +29,9 @@ import (
 // Usage, which doubles as parameter definitions thanks to docopt.
 const usage = `
 Usage:
-  chasquid-util [options] user-add <username> [--password=<password>]
-  chasquid-util [options] user-remove <username>
-  chasquid-util [options] authenticate <username> [--password=<password>]
+  chasquid-util [options] user-add <user@domain> [--password=<password>]
+  chasquid-util [options] user-remove <user@domain>
+  chasquid-util [options] authenticate <user@domain> [--password=<password>]
   chasquid-util [options] check-userdb <domain>
   chasquid-util [options] aliases-resolve <address>
   chasquid-util [options] domaininfo-remove <domain>
@@ -90,7 +90,7 @@ func userDBForDomain(domain string) string {
 }
 
 func userDBFromArgs(create bool) (string, string, *userdb.DB) {
-	username := args["<username>"].(string)
+	username := args["<user@domain>"].(string)
 	user, domain := envelope.Split(username)
 	if domain == "" {
 		Fatalf("Domain missing, username should be of the form 'user@domain'")
@@ -127,7 +127,7 @@ func checkUserDB() {
 	fmt.Println("Database loaded")
 }
 
-// chasquid-util user-add <username> [--password=<password>]
+// chasquid-util user-add <user@domain> [--password=<password>]
 func userAdd() {
 	user, _, db := userDBFromArgs(true)
 	password := getPassword()
@@ -145,7 +145,7 @@ func userAdd() {
 	fmt.Println("Added user")
 }
 
-// chasquid-util authenticate <username> [--password=<password>]
+// chasquid-util authenticate <user@domain> [--password=<password>]
 func authenticate() {
 	user, _, db := userDBFromArgs(false)
 
@@ -185,7 +185,7 @@ func getPassword() string {
 	return string(p1)
 }
 
-// chasquid-util user-remove <username>
+// chasquid-util user-remove <user@domain>
 func userRemove() {
 	user, _, db := userDBFromArgs(false)