clean go.mod, address comments

This commit is contained in:
Kendall Garner 2025-11-30 18:31:58 -08:00
parent b28a87f358
commit f7c3fe8684
No known key found for this signature in database
GPG Key ID: 9355F387FE765C94
2 changed files with 31 additions and 5 deletions

View File

@ -142,6 +142,7 @@ func promptPassword() string {
log.Fatal("Error getting password confirmation", err) log.Fatal("Error getting password confirmation", err)
} }
// clear the line.
fmt.Println() fmt.Println()
pass := string(password) pass := string(password)
@ -155,7 +156,7 @@ func promptPassword() string {
return pass return pass
} }
fmt.Print("Username and password do not match") fmt.Println("Password and password confirmation do not match")
} }
} }
@ -368,7 +369,18 @@ func runUserList() {
if outputFormat == "csv" { if outputFormat == "csv" {
w := csv.NewWriter(os.Stdout) w := csv.NewWriter(os.Stdout)
_ = w.Write([]string{"user id", "username", "user's name", "user email", "admin", "created at", "updated at", "last access", "last login", "last login", "libraries"}) _ = w.Write([]string{
"user id",
"username",
"user's name",
"user email",
"admin",
"created at",
"updated at",
"last access",
"last login",
"libraries",
})
for _, user := range userList { for _, user := range userList {
paths := make([]string, len(user.Libraries)) paths := make([]string, len(user.Libraries))
@ -376,6 +388,20 @@ func runUserList() {
paths[idx] = fmt.Sprintf("%d:%s", library.ID, library.Path) paths[idx] = fmt.Sprintf("%d:%s", library.ID, library.Path)
} }
var lastAccess, lastLogin string
if user.LastAccessAt != nil {
lastAccess = user.LastAccessAt.Format(time.RFC3339Nano)
} else {
lastAccess = "never"
}
if user.LastLoginAt != nil {
lastLogin = user.LastLoginAt.Format(time.RFC3339Nano)
} else {
lastLogin = "never"
}
_ = w.Write([]string{ _ = w.Write([]string{
user.ID, user.ID,
user.UserName, user.UserName,
@ -384,8 +410,8 @@ func runUserList() {
strconv.FormatBool(user.IsAdmin), strconv.FormatBool(user.IsAdmin),
user.CreatedAt.Format(time.RFC3339Nano), user.CreatedAt.Format(time.RFC3339Nano),
user.UpdatedAt.Format(time.RFC3339Nano), user.UpdatedAt.Format(time.RFC3339Nano),
user.LastAccessAt.Format(time.RFC3339Nano), lastAccess,
user.LastLoginAt.Format(time.RFC3339Nano), lastLogin,
fmt.Sprintf("'%s'", strings.Join(paths, ",")), fmt.Sprintf("'%s'", strings.Join(paths, ",")),
}) })
} }

2
go.mod
View File

@ -66,6 +66,7 @@ require (
golang.org/x/net v0.47.0 golang.org/x/net v0.47.0
golang.org/x/sync v0.18.0 golang.org/x/sync v0.18.0
golang.org/x/sys v0.38.0 golang.org/x/sys v0.38.0
golang.org/x/term v0.37.0
golang.org/x/text v0.31.0 golang.org/x/text v0.31.0
golang.org/x/time v0.14.0 golang.org/x/time v0.14.0
google.golang.org/protobuf v1.36.10 google.golang.org/protobuf v1.36.10
@ -131,7 +132,6 @@ require (
golang.org/x/crypto v0.45.0 // indirect golang.org/x/crypto v0.45.0 // indirect
golang.org/x/mod v0.30.0 // indirect golang.org/x/mod v0.30.0 // indirect
golang.org/x/telemetry v0.0.0-20251111182119-bc8e575c7b54 // indirect golang.org/x/telemetry v0.0.0-20251111182119-bc8e575c7b54 // indirect
golang.org/x/term v0.37.0 // indirect
golang.org/x/tools v0.39.0 // indirect golang.org/x/tools v0.39.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect