Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#146): 🐛 issue with spinner #147

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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