User model fixed and flags logic now working
This commit is contained in:
parent
fd3ccc753e
commit
504363799e
2 changed files with 9 additions and 9 deletions
|
@ -101,17 +101,17 @@ func composeListUserOutput(user paneldb.User, usernameFlag, emailFlag, dateCreat
|
||||||
var row string
|
var row string
|
||||||
if usernameFlag {
|
if usernameFlag {
|
||||||
row += user.UserName
|
row += user.UserName
|
||||||
if emailFlag || !dateCreatedFlag {
|
if emailFlag || dateCreatedFlag {
|
||||||
row += "\t"
|
row += "\t"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if emailFlag {
|
if emailFlag {
|
||||||
row += user.Email
|
row += user.Email
|
||||||
if !dateCreatedFlag {
|
if dateCreatedFlag {
|
||||||
row += "\t"
|
row += "\t"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !dateCreatedFlag {
|
if dateCreatedFlag {
|
||||||
row += user.DateCreated
|
row += user.DateCreated
|
||||||
}
|
}
|
||||||
fmt.Fprintln(os.Stdout, row)
|
fmt.Fprintln(os.Stdout, row)
|
||||||
|
@ -131,7 +131,7 @@ func cmdListUsers(args []string) error {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
// Printing the header
|
// Printing the header
|
||||||
if *headerFlag {
|
if !*headerFlag {
|
||||||
header := paneldb.User{
|
header := paneldb.User{
|
||||||
UserName: "username",
|
UserName: "username",
|
||||||
Email: "email",
|
Email: "email",
|
||||||
|
|
10
db/db.go
10
db/db.go
|
@ -9,11 +9,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
Id string
|
ID string `sql:"uid"`
|
||||||
UserName string
|
UserName string `sql:"username"`
|
||||||
Email string
|
Email string `sql:"email"`
|
||||||
DateCreated string
|
DateCreated string `sql:"date_created"`
|
||||||
PasswordHash string
|
PasswordHash string `sql:"password"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DB struct {
|
type DB struct {
|
||||||
|
|
Reference in a new issue