Fixes a number of small details and reworks some shortcut keys
This commit is contained in:
parent
1d44dc779e
commit
6bbd923bf1
|
@ -1 +1,3 @@
|
|||
swim
|
||||
*.json
|
||||
*.swim
|
||||
|
|
9
board.go
9
board.go
|
@ -193,7 +193,7 @@ func (b *Board) EnterCommand() {
|
|||
} else {
|
||||
b.SetMessage("More info needed: 'update [target] [location]'", true)
|
||||
}
|
||||
case "user", "toggle":
|
||||
case "user", "toggle", "t", "u":
|
||||
b.Lanes[b.Current].Stories[b.Lanes[b.Current].Current].Update(f, b)
|
||||
default:
|
||||
b.SetMessage(fmt.Sprintf("Unknown command %q", f[0]), true)
|
||||
|
@ -207,7 +207,11 @@ func (b Board) PrintMessage() string {
|
|||
} else {
|
||||
out.WriteString(style.Message)
|
||||
}
|
||||
out.WriteString(fmt.Sprintf("%-*.*s%s", b.width, b.width, b.message, styleOff))
|
||||
msg := b.message
|
||||
if len(msg) > b.width {
|
||||
msg = msg[:b.width] + "…"
|
||||
}
|
||||
out.WriteString(fmt.Sprintf("%-*s%s", b.width, msg, styleOff))
|
||||
return out.String()
|
||||
}
|
||||
|
||||
|
@ -373,6 +377,7 @@ func (b *Board) Write(com []string) {
|
|||
b.SetMessage(err.Error(), true)
|
||||
return
|
||||
}
|
||||
fp = path
|
||||
defer f.Close()
|
||||
f.Write(j)
|
||||
b.SetMessage("File written", false)
|
||||
|
|
6
lane.go
6
lane.go
|
@ -49,7 +49,11 @@ func (l Lane) StringSlice(width int, selected bool) []string {
|
|||
leadIn = "\033[1m➜ "
|
||||
}
|
||||
out = append(out, fmt.Sprintf("%s%*.*s%s", style.Lane, width, width, " ", styleOff))
|
||||
out = append(out, fmt.Sprintf("%s %s%s%-*.*s%s %s", style.Lane, style.Input, leadIn, width-4, width-4, l.Stories[i].Title, style.Lane, styleOff))
|
||||
title := l.Stories[i].Title
|
||||
if len(title) > width-4 {
|
||||
title = title[:width-5] + "…"
|
||||
}
|
||||
out = append(out, fmt.Sprintf("%s %s%s%-*.*s%s %s", style.Lane, style.Input, leadIn, width-4, width-4, title, style.Lane, styleOff))
|
||||
}
|
||||
if len(out) > 0 {
|
||||
out = append(out, fmt.Sprintf("%s%*.*s%s", style.Lane, width, width, " ", styleOff))
|
||||
|
|
14
story.go
14
story.go
|
@ -43,8 +43,10 @@ func (s *Story) View(b *Board) {
|
|||
Quit()
|
||||
case 'c', 'C':
|
||||
s.AddComment(b)
|
||||
case 't', 'T':
|
||||
case 't':
|
||||
s.AddTask(b)
|
||||
case 'T':
|
||||
s.Update([]string{"title"}, b)
|
||||
case 'u':
|
||||
s.Update([]string{"user"}, b)
|
||||
case 'p':
|
||||
|
@ -156,7 +158,7 @@ func (s *Story) Scroll(dir rune, b *Board) {
|
|||
func (s *Story) Update(args []string, b *Board) {
|
||||
location := strings.ToLower(args[0])
|
||||
switch location {
|
||||
case "title", "t":
|
||||
case "title":
|
||||
title, err := GetAndConfirmCommandLine("New story title: ")
|
||||
if err != nil {
|
||||
b.SetMessage(err.Error(), true)
|
||||
|
@ -178,7 +180,7 @@ func (s *Story) Update(args []string, b *Board) {
|
|||
s.BuildStorySlice(b.width)
|
||||
case "points", "sp", "pts", "p":
|
||||
if len(args) != 2 {
|
||||
ps, err := GetAndConfirmCommandLine("New story description: ")
|
||||
ps, err := GetAndConfirmCommandLine("Set story points: ")
|
||||
if err != nil {
|
||||
b.SetMessage(err.Error(), true)
|
||||
return
|
||||
|
@ -194,7 +196,7 @@ func (s *Story) Update(args []string, b *Board) {
|
|||
s.Updated = time.Now()
|
||||
b.SetMessage("Story points updated", false)
|
||||
s.BuildStorySlice(b.width)
|
||||
case "user":
|
||||
case "user", "u":
|
||||
var users []string
|
||||
if len(args) == 1 {
|
||||
u, err := GetAndConfirmCommandLine("User(s) to add: ")
|
||||
|
@ -207,9 +209,9 @@ func (s *Story) Update(args []string, b *Board) {
|
|||
users = args[1:]
|
||||
}
|
||||
s.AddRemoveUser(users, b)
|
||||
case "toggle":
|
||||
case "toggle", "t":
|
||||
if len(args) < 2 {
|
||||
n, err := GetAndConfirmCommandLine("Task # to toggle: ")
|
||||
n, err := GetCommandLine("Task # to toggle: ")
|
||||
if err != nil {
|
||||
b.SetMessage(err.Error(), true)
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue