aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/bridge.go3
-rw-r--r--commands/comment.go7
-rw-r--r--commands/label_rm.go3
-rw-r--r--commands/ls.go28
-rw-r--r--commands/select.go3
5 files changed, 31 insertions, 13 deletions
diff --git a/commands/bridge.go b/commands/bridge.go
index 2566fd06..3c398e6b 100644
--- a/commands/bridge.go
+++ b/commands/bridge.go
@@ -3,10 +3,11 @@ package commands
import (
"fmt"
+ "github.com/spf13/cobra"
+
"github.com/MichaelMure/git-bug/bridge"
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/util/interrupt"
- "github.com/spf13/cobra"
)
func runBridge(cmd *cobra.Command, args []string) error {
diff --git a/commands/comment.go b/commands/comment.go
index 33bae65d..4be39a84 100644
--- a/commands/comment.go
+++ b/commands/comment.go
@@ -3,13 +3,14 @@ package commands
import (
"fmt"
+ "github.com/MichaelMure/go-term-text"
+ "github.com/spf13/cobra"
+
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/MichaelMure/git-bug/util/colors"
"github.com/MichaelMure/git-bug/util/interrupt"
- "github.com/MichaelMure/git-bug/util/text"
- "github.com/spf13/cobra"
)
func runComment(cmd *cobra.Command, args []string) error {
@@ -41,7 +42,7 @@ func commentsTextOutput(comments []bug.Comment) {
fmt.Printf("Author: %s\n", colors.Magenta(comment.Author.DisplayName()))
fmt.Printf("Id: %s\n", colors.Cyan(comment.Id().Human()))
fmt.Printf("Date: %s\n\n", comment.FormatTime())
- fmt.Println(text.LeftPad(comment.Message, 4))
+ fmt.Println(text.LeftPadLines(comment.Message, 4))
}
}
diff --git a/commands/label_rm.go b/commands/label_rm.go
index a0c1c56d..11300c78 100644
--- a/commands/label_rm.go
+++ b/commands/label_rm.go
@@ -3,10 +3,11 @@ package commands
import (
"fmt"
+ "github.com/spf13/cobra"
+
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/MichaelMure/git-bug/util/interrupt"
- "github.com/spf13/cobra"
)
func runLabelRm(cmd *cobra.Command, args []string) error {
diff --git a/commands/ls.go b/commands/ls.go
index 9c32642e..70a948e6 100644
--- a/commands/ls.go
+++ b/commands/ls.go
@@ -4,11 +4,12 @@ import (
"fmt"
"strings"
+ text "github.com/MichaelMure/go-term-text"
+ "github.com/spf13/cobra"
+
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/util/colors"
"github.com/MichaelMure/git-bug/util/interrupt"
- "github.com/MichaelMure/git-bug/util/text"
- "github.com/spf13/cobra"
)
var (
@@ -65,17 +66,30 @@ func runLsBug(cmd *cobra.Command, args []string) error {
name = b.LegacyAuthor.DisplayName()
}
+ var labelsTxt strings.Builder
+ for _, l := range b.Labels {
+ lc256 := l.Color().Term256()
+ labelsTxt.WriteString(lc256.Escape())
+ labelsTxt.WriteString(" ◼")
+ labelsTxt.WriteString(lc256.Unescape())
+ }
+
// truncate + pad if needed
- titleFmt := text.LeftPadMaxLine(b.Title, 50, 0)
+ labelsFmt := text.TruncateMax(labelsTxt.String(), 10)
+ titleFmt := text.LeftPadMaxLine(b.Title, 50-text.Len(labelsFmt), 0)
authorFmt := text.LeftPadMaxLine(name, 15, 0)
- fmt.Printf("%s %s\t%s\t%s\tC:%d L:%d\n",
+ comments := fmt.Sprintf("%4d 💬", b.LenComments)
+ if b.LenComments > 9999 {
+ comments = " ∞ 💬"
+ }
+
+ fmt.Printf("%s %s\t%s\t%s\t%s\n",
colors.Cyan(b.Id.Human()),
colors.Yellow(b.Status),
- titleFmt,
+ titleFmt+labelsFmt,
colors.Magenta(authorFmt),
- b.LenComments,
- len(b.Labels),
+ comments,
)
}
diff --git a/commands/select.go b/commands/select.go
index 7c40df5c..f2ae33ca 100644
--- a/commands/select.go
+++ b/commands/select.go
@@ -4,10 +4,11 @@ import (
"errors"
"fmt"
+ "github.com/spf13/cobra"
+
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/MichaelMure/git-bug/util/interrupt"
- "github.com/spf13/cobra"
)
func runSelect(cmd *cobra.Command, args []string) error {