user.go (582B)
1 package command 2 3 import ( 4 "errors" 5 "fmt" 6 "os" 7 "time" 8 9 "code.dwrz.net/src/pkg/dqs/command/help" 10 "code.dwrz.net/src/pkg/dqs/store" 11 ) 12 13 var User = &command{ 14 execute: func(args []string, date time.Time, store *store.Store) error { 15 u, err := store.GetUser() 16 if err != nil && !errors.Is(err, os.ErrNotExist) { 17 return fmt.Errorf("failed to get user: %w", err) 18 } 19 if u == nil { 20 return Config.execute(args, date, store) 21 } 22 23 fmt.Println(u.FormatPrint()) 24 25 return nil 26 }, 27 28 description: "display user data and settings", 29 help: help.User, 30 name: "user", 31 }