Skip to content

Commit

Permalink
fix(#146): 🐛 issue with spinner
Browse files Browse the repository at this point in the history
remove spinner

Signed-off-by: Andy Augustin <[email protected]>
  • Loading branch information
AndreasAugustin committed May 28, 2024
1 parent f565196 commit f20bfb6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 30 deletions.
10 changes: 5 additions & 5 deletions cmd/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ var CommitCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
log.Debug("commit called")
log.Debug(commitMsg)
spin := ui.NewSpinner()
spin.Run()
defer func() { spin.Stop() }()
//spin := ui.NewSpinner()
//spin.Run()
//defer func() { spin.Stop() }()
existentHookFiles, err := pkg.HookFilesExistent()
if err != nil {
log.Fatalf("Error checking if hook files existent")
}
if len(existentHookFiles) > 0 {
log.Infof("There are hook files existent for %s", existentHookFiles)
log.Infof("Please use git commit command or remove the hooks with %s hooks rm", pkg.ProgramName)
spin.Stop()
//spin.Stop()
return
}
config, err := pkg.GetCurrentConfig()
Expand All @@ -49,7 +49,7 @@ var CommitCmd = &cobra.Command{
commitMsg,
gitmojis.Gitmojis,
)
spin.Stop()
//spin.Stop()
commitValues := ui.CommitPrompt(config, gitmojis.Gitmojis, initialCommitValues, isBreaking)
log.Debugf("complete title: %s", commitValues.Title)
if isDryRun {
Expand Down
24 changes: 12 additions & 12 deletions cmd/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ var HooksRemoveCmd = &cobra.Command{
Long: `Delete the commit hooks which are created by the cli`,
Run: func(cmd *cobra.Command, args []string) {
log.Debug("hooks rm called")
spin := ui.NewSpinner()
spin.Run()
defer func() { spin.Stop() }()
//spin := ui.NewSpinner()
//spin.Run()
//defer func() { spin.Stop() }()
err := pkg.RemoveAllHookFiles()
if err != nil {
log.Error(err)
Expand All @@ -36,11 +36,11 @@ var HooksInitCmd = &cobra.Command{
Long: `Install the commit hooks into the local .git/hooks/ directory.`,
Run: func(cmd *cobra.Command, args []string) {
log.Debug("hooks init called")
spin := ui.NewSpinner()
spin.Run()
defer func() {
spin.Stop()
}()
//spin := ui.NewSpinner()
//spin.Run()
//defer func() {
// spin.Stop()
//}()
err := pkg.CreateAllHookFiles()
if err != nil {
log.Error(err)
Expand Down Expand Up @@ -105,9 +105,9 @@ func init() {
func hookCommit(commitMsgFile string, config pkg.Config) {
log.Debug("hook --hooks called")
log.Debug(commitMsg)
spin := ui.NewSpinner()
spin.Run()
defer func() { spin.Stop() }()
//spin := ui.NewSpinner()
//spin.Run()
//defer func() { spin.Stop() }()
existentHookFiles, err := pkg.HookFilesExistent()
if err != nil {
log.Fatalf("Error checking if hook files existent")
Expand All @@ -132,7 +132,7 @@ func hookCommit(commitMsgFile string, config pkg.Config) {
Desc: parsedMessages.Desc,
Body: parsedMessages.Body,
}
spin.Stop()
//spin.Stop()
commitValues := ui.CommitPrompt(config, gitmojis.Gitmojis, initialCommitValues, isBreaking)
commitMessage := fmt.Sprintf("%s\n\n%s", commitValues.Title, commitValues.Body)
err = utils.WriteFile(commitMsgFile, []byte(commitMessage))
Expand Down
14 changes: 7 additions & 7 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ var ListCommitTypesCmd = &cobra.Command{
Long: "The list from conventional commits is used",
Run: func(cmd *cobra.Command, args []string) {
log.Debug("list commit-types called")
spin := ui.NewSpinner()
spin.Run()
defer func() { spin.Stop() }()
//spin := ui.NewSpinner()
//spin.Run()
//defer func() { spin.Stop() }()
defaultTypes := pkg.DefaultCommitTypes()
spin.Stop()
//spin.Stop()
listSettings := ui.ListSettings{Title: "Commit types", IsShowStatusBar: true, IsFilteringEnabled: true}
selectedDefaultType := ui.ListRun(listSettings, defaultTypes)
log.Debugf("selected %s", selectedDefaultType)
Expand All @@ -31,14 +31,14 @@ var ListGitmojisCmd = &cobra.Command{
Long: fmt.Sprintf(`The list is queried from the api %s.`, pkg.DefaultGitmojiApiUrl),
Run: func(cmd *cobra.Command, args []string) {
log.Debug("list gitmojis called")
spin := ui.NewSpinner()
spin.Run()
//spin := ui.NewSpinner()
//spin.Run()
config, err := pkg.GetCurrentConfig()
if err != nil {
log.Fatalf("get current config issue, %s", err)
}
gitmojis := pkg.GetGitmojis(config)
spin.Stop()
//spin.Stop()
listSettings := ui.ListSettings{Title: "Gitmojis", IsShowStatusBar: true, IsFilteringEnabled: true}
selectedGitmoji := ui.ListRun(listSettings, gitmojis.Gitmojis)
log.Debugf("selected %s", selectedGitmoji)
Expand Down
11 changes: 5 additions & 6 deletions cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"fmt"
"github.com/AndreasAugustin/go-gitmoji-cli/pkg"
"github.com/AndreasAugustin/go-gitmoji-cli/pkg/ui"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand All @@ -14,11 +13,11 @@ var UpdateGitmojisCmd = &cobra.Command{
Long: fmt.Sprintf(`Update the gitmojis local cache from %s.`, pkg.DefaultGitmojiApiUrl),
Run: func(cmd *cobra.Command, args []string) {
log.Debug("update gitmojis called")
spin := ui.NewSpinner()
spin.Run()
defer func() {
spin.Stop()
}()
//spin := ui.NewSpinner()
//spin.Run()
//defer func() {
// spin.Stop()
//}()
config, err := pkg.GetCurrentConfig()
if err != nil {
log.Fatalf("get current config issue, %s", err)
Expand Down

0 comments on commit f20bfb6

Please sign in to comment.