Skip to content

Commit 1ed4d4b

Browse files
committed
close #115 workon is too verbose
1 parent 9c9f431 commit 1ed4d4b

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

phlow/workon.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,28 @@ import (
44
"fmt"
55
"os"
66

7+
"strconv"
8+
79
"github.com/praqma/git-phlow/githandler"
810
"github.com/praqma/git-phlow/plugins"
911
"github.com/praqma/git-phlow/ui"
10-
"strconv"
1112
)
1213

1314
//WorkOn ...
1415
func WorkOn(issue int) {
15-
16-
ui.PhlowSpinner.Start("Fetching from remote")
16+
ui.PhlowSpinner.Start("Setting up workspace")
17+
defer ui.PhlowSpinner.Stop()
1718
if err := githandler.Fetch(); err != nil {
1819
fmt.Println(err)
1920
return
2021
}
21-
ui.PhlowSpinner.Stop()
22-
fmt.Println("Fetch successful")
2322

2423
branchInfo, err := githandler.Branch()
2524
if err != nil {
2625
fmt.Println("Could not get branches")
2726
return
2827
}
2928

30-
fmt.Fprintln(os.Stdout, "Locating existing issue branches")
3129
if plugins.IssueFromBranchName(branchInfo.Current) == issue {
3230
fmt.Fprintf(os.Stdout, "You are already on branch %s \n", ui.Format.Branch(branchInfo.Current))
3331
return
@@ -38,11 +36,11 @@ func WorkOn(issue int) {
3836
if err = githandler.CheckOut(branch); err != nil {
3937
fmt.Println(err)
4038
}
41-
fmt.Fprintf(os.Stdout, "Switched to branch %s \n", ui.Format.Branch(branch))
39+
ui.PhlowSpinner.Stop()
40+
fmt.Fprintf(os.Stdout, "Resuming to workspace: %s \n", ui.Format.Branch(branch))
4241
return
4342
}
4443
}
45-
fmt.Fprintf(os.Stdout, "No local %s found. Checking GitHub \n", ui.Format.Bold("issue-branches"))
4644

4745
//Get list of gh issues
4846
gitHubIssues, err := plugins.GitHub.GetIssues()
@@ -64,15 +62,16 @@ func WorkOn(issue int) {
6462
fmt.Println(err)
6563
return
6664
}
67-
fmt.Fprintf(os.Stdout, "Created and checked out branch %s \n", ui.Format.Branch(name))
65+
ui.PhlowSpinner.Stop()
66+
fmt.Fprintf(os.Stdout, "Created workspace: %s \n", ui.Format.Branch(name))
6867

6968
//Set labels and Assignee
7069
UpdateIssue(issue)
7170
return
7271
}
7372
}
74-
75-
fmt.Println("Found no issues matching your input")
73+
ui.PhlowSpinner.Stop()
74+
fmt.Println("No matching issues")
7675
}
7776

7877
//UpdateIssue ...

0 commit comments

Comments
 (0)