Skip to content

Commit 996e05c

Browse files
Raj Nandan SharmaRaj Nandan Sharma
Raj Nandan Sharma
authored and
Raj Nandan Sharma
committed
fix(cmd): fixed bug in pull and removed lorem ipsum
CHANGE: issue #2
1 parent 88ffce5 commit 996e05c

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

cmd/done.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package cmd
22

33
import (
4-
"fmt"
5-
64
"github.com/spf13/cobra"
75
)
86

@@ -12,10 +10,6 @@ var doneCmd = &cobra.Command{
1210
Long: "Do add commit and push at one go. Example usage: okgit done",
1311
Run: func(cmd *cobra.Command, args []string) {
1412

15-
fmt.Println("--------------")
16-
fmt.Println("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
17-
fmt.Println("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
18-
fmt.Println("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
1913
addCmd.Run(cmd, args)
2014
commitCmd.Run(cmd, args)
2115
pushCmd.Run(cmd, args)

cmd/pull.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ var pullCmd = &cobra.Command{
4343
gitPull.Arguments = append(gitPull.Arguments, string(branch))
4444
cmdOut, cmdErr = utils.RunCommand(gitPull.Name, gitPull.Arguments, "")
4545
if cmdErr != nil {
46-
utils.LogFatal(cmdErr)
46+
utils.LogNonFatal(cmdErr)
47+
} else {
48+
utils.LogOutput(cmdOut)
4749
}
48-
utils.LogOutput(cmdOut)
4950

5051
},
5152
}

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var rootCmd = &cobra.Command{
1717
// Uncomment the following line if your bare application
1818
// has an action associated with it:
1919
// Run: func(cmd *cobra.Command, args []string) { },
20-
Version: "1.0.15",
20+
Version: "1.0.18",
2121
}
2222

2323
// Execute adds all child commands to the root command and sets flags appropriately.

utils/fs.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ func LogFatal(err error) {
174174
log.Fatal(red(err.Error()))
175175
}
176176
}
177+
func LogNonFatal(err error) {
178+
if err != nil {
179+
red := color.New(color.FgRed).SprintFunc()
180+
log.Print(red(err.Error()))
181+
}
182+
}
177183

178184
func LogOutput(output string) {
179185
if output != "" {

0 commit comments

Comments
 (0)