Skip to content

Commit

Permalink
style(cli): improve status command visual feedback and messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
JaleelB committed Dec 13, 2024
1 parent 743906c commit 5bb364b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 3 additions & 1 deletion internal/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func CLIMenu(

mainOptions := []options{
{Name: "Configure", Context: "Configure JiraFlow for this repository"},
{Name: "Status", Context: "Check JiraFlow status"},
{Name: "Status", Context: "Check JiraFlow status in this repository"},
{Name: "Remove", Context: "Remove JiraFlow from this repository"},
{Name: "Exit", Context: "Exit JiraFlow"},
}
Expand Down Expand Up @@ -197,6 +197,8 @@ func CLIMenu(
switch mainOptions[idx].Name {
case "Configure":
configureJiraFlow(jiraManager)
case "Status":
CheckStatus(config)
case "Remove":
removeJiraFlow(jiraManager)
case "Exit":
Expand Down
17 changes: 12 additions & 5 deletions internal/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"fmt"
"os"
"path/filepath"

"github.com/logrusorgru/aurora"
)

func CheckStatus(config *Config) {
Expand All @@ -14,14 +16,19 @@ func CheckStatus(config *Config) {

isActive := isHookPresent(commitMsgHook) && isHookPresent(postCheckoutHook)

fmt.Println("\nJiraFlow Status:")
fmt.Println("---------------")

if isActive {
fmt.Println("✓ JiraFlow is active in this repository")
fmt.Println("Installed hooks:")
fmt.Println(" - commit-msg")
fmt.Println(" - post-checkout")
fmt.Println(aurora.BrightGreen("✓ JiraFlow is active in this repository"))
fmt.Println(aurora.White("\nInstalled hooks:"))
fmt.Println(aurora.BrightCyan(" - commit-msg"))
fmt.Println(aurora.BrightCyan(" - post-checkout"))
} else {
fmt.Println("✗ JiraFlow is not active in this repository")
fmt.Println(aurora.BrightRed("✗ JiraFlow is not active in this repository"))
fmt.Println(aurora.Gray(12, "\nRun 'jira-flow init' to configure JiraFlow"))
}
fmt.Println() // Add empty line for spacing
}

func isHookPresent(hookPath string) bool {
Expand Down

0 comments on commit 5bb364b

Please sign in to comment.