-
Notifications
You must be signed in to change notification settings - Fork 8
/
cmdline.go
77 lines (67 loc) · 2.42 KB
/
cmdline.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
Copyright © 2019, 2020 M.Watermann, 10247 Berlin, Germany
All rights reserved
EMail : <support@mwat.de>
*/
package kaliber
//lint:file-ignore ST1017 - I prefer Yoda conditions
/*
* This file provides functions to maintain a user/password file.
*/
import (
"github.com/mwat56/passlist"
)
// ListUsers reads `aFilename` and lists all users stored in there.
//
// NOTE: This function does not return but terminates the program
// with error code `0` (zero) if successful, or `1` (one) otherwise.
//
// `aFilename` name of the password file to use.
func ListUsers(aFilename string) {
passlist.ListUsers(aFilename)
} // ListUsers()
// UserAdd reads a password for `aUser` from the commandline
// and adds it to `aFilename`.
//
// NOTE: This function does not return but terminates the program
// with error code `0` (zero) if successful, or `1` (one) otherwise.
//
// `aUser` the username to add to the password file.
// `aFilename` name of the password file to use.
func UserAdd(aUser, aFilename string) {
passlist.AddUser(aUser, aFilename)
} // UserAdd()
// UserCheck reads a password for `aUser` from the commandline
// and compares it with the one stored in `aFilename`.
//
// NOTE: This function does not return but terminates the program
// with error code `0` (zero) if successful, or `1` (one) otherwise.
//
// `aUser` the username to check in the password file.
// `aFilename` name of the password file to use.
func UserCheck(aUser, aFilename string) {
passlist.CheckUser(aUser, aFilename)
} // UserCheck()
// UserDelete removes the entry for `aUser` from the password
// list `aFilename`.
//
// NOTE: This function does not return but terminates the program
// with error code `0` (zero) if successful, or `1` (one) otherwise.
//
// `aUser` the username to remove from the password file.
// `aFilename` name of the password file to use.
func UserDelete(aUser, aFilename string) {
passlist.DeleteUser(aUser, aFilename)
} // UserDelete()
// UserUpdate reads a password for `aUser` from the commandline
// and updates the entry in the password list `aFilename`.
//
// NOTE: This function does not return but terminates the program
// with error code `0` (zero) if successful, or `1` (one) otherwise.
//
// `aUser` the username to remove from the password file.
// `aFilename` name of the password file to use.
func UserUpdate(aUser, aFilename string) {
passlist.UpdateUser(aUser, aFilename)
} // UserUpdate()
/* _EoF_ */