@@ -39,16 +39,8 @@ func statusAction(c *cli.Context) error {
39
39
if err != nil {
40
40
return err
41
41
}
42
- var color cliutil.StatusColor = & cliutil.StatusColorEnabled {}
43
- if c .Bool ("no-ansi" ) || ! terminal .IsTerminal (int (os .Stdout .Fd ())) {
44
- color = & cliutil.StatusColorDisabled {}
45
- }
46
- printStatus := printLongStatus
47
- if c .Bool ("no-status" ) {
48
- printStatus = printOnlyPaths
49
- } else if c .Bool ("short" ) {
50
- printStatus = printShortStatus
51
- }
42
+ color := getStatusColor (c )
43
+ printStatus := getPrintStatus (c )
52
44
for _ , repoStatus := range repoStatuses {
53
45
if ! c .Bool ("all" ) && repoStatus .GetGitStatus () == domain .UpToDate {
54
46
continue
@@ -58,6 +50,22 @@ func statusAction(c *cli.Context) error {
58
50
return nil
59
51
}
60
52
53
+ func getPrintStatus (c * cli.Context ) func (domain.RepoStatus , cliutil.StatusColor ) {
54
+ if c .Bool ("no-status" ) {
55
+ return printOnlyPaths
56
+ } else if c .Bool ("short" ) {
57
+ return printShortStatus
58
+ }
59
+ return printLongStatus
60
+ }
61
+
62
+ func getStatusColor (c * cli.Context ) cliutil.StatusColor {
63
+ if c .Bool ("no-ansi" ) || ! terminal .IsTerminal (int (os .Stdout .Fd ())) {
64
+ return & cliutil.StatusColorDisabled {}
65
+ }
66
+ return & cliutil.StatusColorEnabled {}
67
+ }
68
+
61
69
func printLongStatus (repoStatus domain.RepoStatus , color cliutil.StatusColor ) {
62
70
fmt .Printf ("%s: %s\n " , gitStatusToLongString (repoStatus .GetGitStatus (), color ), repoStatus .GetPath ())
63
71
}
0 commit comments