User model fixed and flags logic now working

This commit is contained in:
Blallo 2018-09-29 14:06:50 +02:00
parent fd3ccc753e
commit 504363799e
2 changed files with 9 additions and 9 deletions

View file

@ -101,17 +101,17 @@ func composeListUserOutput(user paneldb.User, usernameFlag, emailFlag, dateCreat
var row string
if usernameFlag {
row += user.UserName
if emailFlag || !dateCreatedFlag {
if emailFlag || dateCreatedFlag {
row += "\t"
}
}
if emailFlag {
row += user.Email
if !dateCreatedFlag {
if dateCreatedFlag {
row += "\t"
}
}
if !dateCreatedFlag {
if dateCreatedFlag {
row += user.DateCreated
}
fmt.Fprintln(os.Stdout, row)
@ -131,7 +131,7 @@ func cmdListUsers(args []string) error {
os.Exit(1)
}
// Printing the header
if *headerFlag {
if !*headerFlag {
header := paneldb.User{
UserName: "username",
Email: "email",

View file

@ -9,11 +9,11 @@ import (
)
type User struct {
Id string
UserName string
Email string
DateCreated string
PasswordHash string
ID string `sql:"uid"`
UserName string `sql:"username"`
Email string `sql:"email"`
DateCreated string `sql:"date_created"`
PasswordHash string `sql:"password"`
}
type DB struct {