func list() { users := s.GetUserNames() for _, user := range users { n, _ := bux.Get(user) fmt.Printf("%20s %v\n", user, n) } }
func transfer() { to := os.Args[1] astring := os.Args[2] comment := strings.Join(os.Args[3:], " ") err := bux.Transfer(to, astring, comment) if err != nil { fail(err.Error()) } cnew, err := bux.Get(current) if err != nil { fail(err.Error()) } tnew, err := bux.Get(to) if err != nil { fail(err.Error()) } fmt.Printf("%s%s%s bux from %s%s %s(%v) %sto %s%s %s(%v)%s\n", c.B3, astring, c.Y, c.B2, current, c.R, cnew, c.Y, c.B2, to, c.G, tnew, c.X) }
func show(u string) { if u == "all" { all() } else if u == "list" { list() } else { n, err := bux.Get(u) if err != nil { fmt.Println(err) } else { who := u + " has" if u == current { who = "You have" } plural := "SkilBux" if n == 1 { plural = "SkilBuk" } fmt.Printf("%s%s %s%v%s %s.%s\n", c.Y, who, c.M, n, c.Y, plural, c.X) } } }