Skip to content

Commit

Permalink
fix(cmd): fixed bug in pull and removed lorem ipsum
Browse files Browse the repository at this point in the history
CHANGE: issue #2
  • Loading branch information
Raj Nandan Sharma authored and Raj Nandan Sharma committed May 30, 2024
1 parent 88ffce5 commit 996e05c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
6 changes: 0 additions & 6 deletions cmd/done.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cmd

import (
"fmt"

"github.com/spf13/cobra"
)

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

fmt.Println("--------------")
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.")
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.")
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.")
addCmd.Run(cmd, args)
commitCmd.Run(cmd, args)
pushCmd.Run(cmd, args)
Expand Down
5 changes: 3 additions & 2 deletions cmd/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ var pullCmd = &cobra.Command{
gitPull.Arguments = append(gitPull.Arguments, string(branch))
cmdOut, cmdErr = utils.RunCommand(gitPull.Name, gitPull.Arguments, "")
if cmdErr != nil {
utils.LogFatal(cmdErr)
utils.LogNonFatal(cmdErr)
} else {
utils.LogOutput(cmdOut)
}
utils.LogOutput(cmdOut)

},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var rootCmd = &cobra.Command{
// Uncomment the following line if your bare application
// has an action associated with it:
// Run: func(cmd *cobra.Command, args []string) { },
Version: "1.0.15",
Version: "1.0.18",
}

// Execute adds all child commands to the root command and sets flags appropriately.
Expand Down
6 changes: 6 additions & 0 deletions utils/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ func LogFatal(err error) {
log.Fatal(red(err.Error()))
}
}
func LogNonFatal(err error) {
if err != nil {
red := color.New(color.FgRed).SprintFunc()
log.Print(red(err.Error()))
}
}

func LogOutput(output string) {
if output != "" {
Expand Down

0 comments on commit 996e05c

Please sign in to comment.