diff --git a/README.md b/README.md index 257cc9d..bc0a8eb 100644 --- a/README.md +++ b/README.md @@ -138,10 +138,17 @@ go-gitmoji-cli --version ```bash # list the available gitmojis -go-gitmoji-cli list +go-gitmoji-cli list gitmojis ``` -![list](docs/assets/list.gif) +![list](docs/assets/list_gitmojis.gif) + +```bash +# list the available commit types +go-gitmoji-cli list commit-types +``` + +![list](docs/assets/list_commit_types.gif) ### Commit diff --git a/cmd/commit.go b/cmd/commit.go index 2df33b9..3c54715 100644 --- a/cmd/commit.go +++ b/cmd/commit.go @@ -40,12 +40,16 @@ var CommitCmd = &cobra.Command{ log.Fatalf("get current config issue, %s", err) } gitmojis := pkg.GetGitmojis(config) - + defaultTypes := pkg.DefaultCommitTypes() initialCommitValues := pkg.BuildInitialCommitValues(_type, scope, desc, body, commitMsg) - listSettings := ui.ListSettings{IsShowStatusBar: true, IsFilteringEnabled: true, Title: "Gitmojis"} + listSettingsGitmojis := ui.ListSettings{IsShowStatusBar: true, IsFilteringEnabled: true, Title: "Gitmojis"} + listSettingsCommitTypes := ui.ListSettings{Title: "Commit types", IsShowStatusBar: true, IsFilteringEnabled: true} spin.Stop() - selectedGitmoji := ui.ListRun(listSettings, gitmojis.Gitmojis) + selectedGitmoji := ui.ListRun(listSettingsGitmojis, gitmojis.Gitmojis) log.Debugf("selected gitmoji %s", selectedGitmoji) + selectedDefaultType := ui.ListRun(listSettingsCommitTypes, defaultTypes) + log.Debugf("selected %s", selectedDefaultType) + initialCommitValues.Type = selectedDefaultType.Type textInputsData := initialCommitValues.BuildTextInputsData(config) inputsRes := ui.TextInputsRun("please add", textInputsData) diff --git a/cmd/list.go b/cmd/list.go index e9b7bdc..bd8e39f 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -8,13 +8,28 @@ import ( "github.com/spf13/cobra" ) -// ListCmd represents the list command -var ListCmd = &cobra.Command{ - Use: "list", +var ListCommitTypesCmd = &cobra.Command{ + Use: "commit-types", + Short: "List all the available commit types", + 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() + defaultTypes := pkg.DefaultCommitTypes() + spin.Stop() + listSettings := ui.ListSettings{Title: "Commit types", IsShowStatusBar: true, IsFilteringEnabled: true} + selectedDefaultType := ui.ListRun(listSettings, defaultTypes) + log.Debugf("selected %s", selectedDefaultType) + }, +} + +var ListGitmojisCmd = &cobra.Command{ + Use: "gitmojis", Short: "List all the available gitmojis", Long: fmt.Sprintf(`The list is queried from the api %s.`, pkg.DefaultGitmojiApiUrl), Run: func(cmd *cobra.Command, args []string) { - log.Debug("list called") + log.Debug("list gitmojis called") spin := ui.NewSpinner() spin.Run() config, err := pkg.GetCurrentConfig() @@ -29,6 +44,17 @@ var ListCmd = &cobra.Command{ }, } +var ListCmd = &cobra.Command{ + Use: "list", + Short: "List all the available gitmojis", + Long: fmt.Sprintf(`The list is queried from the api %s.`, pkg.DefaultGitmojiApiUrl), + Run: func(cmd *cobra.Command, args []string) { + log.Debug("list called") + }, +} + func init() { RootCmd.AddCommand(ListCmd) + ListCmd.AddCommand(ListGitmojisCmd) + ListCmd.AddCommand(ListCommitTypesCmd) } diff --git a/docs/Makefile b/docs/Makefile index 5a1b45b..ff32f78 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -5,7 +5,7 @@ SHELL := /bin/bash # VARIABLES ########################### -TAPES := commit.tape config.tape help.tape list.tape version.tape +TAPES := commit.tape config.tape help.tape list_commit_types.tape list_gitmojis.tape version.tape ########################### # MAPPINGS diff --git a/docs/assets/commit.gif b/docs/assets/commit.gif index 32b9394..012d376 100644 --- a/docs/assets/commit.gif +++ b/docs/assets/commit.gif @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c329a6103243d6ad2ea4011bf79c200d55291e4047b933ae74cbc42c43bca12 -size 146672 +oid sha256:a6c3dbdac64e872475788a617be33ed0bb50f045bc6c62bb154adf0fbdf8c1bc +size 161228 diff --git a/docs/assets/list.gif b/docs/assets/list.gif deleted file mode 100644 index 3bd3844..0000000 --- a/docs/assets/list.gif +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0d66c3b0bc11fe0db2a55c2c6205eb4991f4559b230d87b6dfcb039120154acf -size 165376 diff --git a/docs/assets/list_commit_types.gif b/docs/assets/list_commit_types.gif new file mode 100644 index 0000000..539ec43 --- /dev/null +++ b/docs/assets/list_commit_types.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55f7c8617bcd18fcb677fd1f193468ef83c8999a0ba519eb40447e0ab9f28893 +size 194496 diff --git a/docs/assets/list_gitmojis.gif b/docs/assets/list_gitmojis.gif new file mode 100644 index 0000000..76556d7 --- /dev/null +++ b/docs/assets/list_gitmojis.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd9b51c7c0636603eb092d2aa02ebfa676812995fea7f6d65b3c3d5161ecd2aa +size 181502 diff --git a/docs/commit.tape b/docs/commit.tape index 4c45879..66dd5fa 100644 --- a/docs/commit.tape +++ b/docs/commit.tape @@ -65,11 +65,14 @@ Sleep 500ms Type "go-gitmoji-cli commit --dry-run" Sleep 500ms Enter +# gitmojis Sleep 1s Enter +# commit types Sleep 1s -Type "feat" -Sleep 500ms +# Type "feat" +Enter +# type and feat prompt Enter Type "this is an example" Sleep 500ms diff --git a/docs/list_commit_types.tape b/docs/list_commit_types.tape new file mode 100644 index 0000000..e547775 --- /dev/null +++ b/docs/list_commit_types.tape @@ -0,0 +1,80 @@ +# VHS documentation +# +# Output: +# Output .gif Create a GIF output at the given +# Output .mp4 Create an MP4 output at the given +# Output .webm Create a WebM output at the given +# +# Require: +# Require Ensure a program is on the $PATH to proceed +# +# Settings: +# Set FontSize Set the font size of the terminal +# Set FontFamily Set the font family of the terminal +# Set Height Set the height of the terminal +# Set Width Set the width of the terminal +# Set LetterSpacing Set the font letter spacing (tracking) +# Set LineHeight Set the font line height +# Set LoopOffset % Set the starting frame offset for the GIF loop +# Set Theme Set the theme of the terminal +# Set Padding Set the padding of the terminal +# Set Framerate Set the framerate of the recording +# Set PlaybackSpeed Set the playback speed of the recording +# Set MarginFill Set the file or color the margin will be filled with. +# Set Margin Set the size of the margin. Has no effect if MarginFill isn't set. +# Set BorderRadius Set terminal border radius, in pixels. +# Set WindowBar Set window bar type. (one of: Rings, RingsRight, Colorful, ColorfulRight) +# Set WindowBarSize Set window bar size, in pixels. Default is 40. +# Set TypingSpeed