Skip to content
New issue

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

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

Already on GitHub? # to your account

[Feature Request] Support for multiple scopes #14

Closed
jaklan opened this issue Apr 19, 2022 · 7 comments
Closed

[Feature Request] Support for multiple scopes #14

jaklan opened this issue Apr 19, 2022 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@jaklan
Copy link
Contributor

jaklan commented Apr 19, 2022

💭 Describe the feature

commitlint provides support for multiple scopes:
https://commitlint.js.org/#/concepts-commit-conventions?id=multiple-scopes

When you use @commitlint/cz-commitlint adapter, you can enable support for that in commitizen as well by providing the following options in commitlint config:

  prompt: {
    settings: {
      enableMultipleScopes: true
      scopeEnumSeparator: ","
    },
  }

https://commitlint.js.org/#/reference-prompt?id=settings

Then, you can select multiple scopes in commitizen with space and confirm with enter. If empty scopes are forbidden, if no scope is selected you get the hint you need to select at least one to continue.

💡 Proposed Solution

To respect the above configuration. The one issue I see is the fact that in cz-git space is used as input to search, but imho in that case we can "override" its behaviour to select the scope instead - scopes with spaces are rather rare use-case, so imho such a compromise should be quite acceptable. Or we can just think about another keystroke to trigger scope selection / unselection (right arrow to select, left arrow to unselect?).

@jaklan jaklan added the enhancement New feature or request label Apr 19, 2022
@Zhengqbbb
Copy link
Owner

commitlint provides support for multiple scopes: https://commitlint.js.org/#/concepts-commit-conventions?id=multiple-scopes

Yeah ! I checked their source code is done using inquirer/checkbox
And we are currently using inquirer-autocomplete-prompt.It experience is very nice but currently does not support multiple selection

Then, you can select multiple scopes in commitizen with space and confirm with enter. If empty scopes are forbidden, if no scope is selected you get the hint you need to select at least one to continue.

If he doesn't choose he can't go to the next question

💡 Proposed Solution

To respect the above configuration. The one issue I see is the fact that in cz-git space is used as input to search, but imho in that case we can "override" its behaviour to select the scope instead - scopes with spaces are rather rare use-case, so imho such a compromise should be quite acceptable. Or we can just think about another keystroke to trigger scope selection / unselection (right arrow to select, left arrow to unselect?).

I think borrowing can be done with inquirer-checkbox-plus-prompt, but then I have to write one myself. 🤣

@jaklan
Copy link
Contributor Author

jaklan commented Apr 19, 2022

@Zhengqbbb https://github.com/faressoft/inquirer-checkbox-plus-prompt - such library actually already exists 😃 (or maybe I just misunderstood your comment about "writing the one myself" 🙈)

@Zhengqbbb
Copy link
Owner

@Zhengqbbb https://github.com/faressoft/inquirer-checkbox-plus-prompt - such library actually already exists 😃 (or maybe I just misunderstood your comment about "writing the one myself" 🙈)

LOL, once my own personality starts, I will write all the inquirers myself 🤯.

Zhengqbbb added a commit that referenced this issue May 11, 2022
need turn on option: `enableMultipleScopes`

link #14
Zhengqbbb added a commit that referenced this issue May 11, 2022
Zhengqbbb added a commit that referenced this issue May 12, 2022
feat: support for multiple scopes
@Zhengqbbb
Copy link
Owner

Zhengqbbb commented May 12, 2022

Hey bro ! @jaklan
The latest version 🌟(v1.2.9)🌟 is support for multiple scopes . 💪

demo

Now yet I haven't added tests yet to make sure the checkboxes work, I need to add tests later
👀 Please have a try. Let me know if there are still any issues. Thanks for reporting it! 🎉

@Zhengqbbb
Copy link
Owner

@jaklan Hi, The latest version 🌟(v1.3.1)🌟
You can enable multiple scopes mode without configuration
Try it !

checkbox=1 cz
# same it can turn on emoji mode
emoji=1 cz

@jaklan
Copy link
Contributor Author

jaklan commented Sep 18, 2022

Hello @Zhengqbbb, sorry for a late response, I've finally found some time to test multiple scopes - and they work really nice, thank you!

@Zhengqbbb
Copy link
Owner

Zhengqbbb commented Sep 18, 2022

Hello @Zhengqbbb, sorry for a late response, I've finally found some time to test multiple scopes - and they work really nice, thank you!

Great 🤗 Thx u response ~

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants