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: Fixed a naming bug and added emoji_skip in sc.toml #13

Merged
merged 3 commits into from
Jul 3, 2024

Conversation

ramiro-l
Copy link
Contributor

@ramiro-l ramiro-l commented Jul 3, 2024

No description provided.

Copy link
Owner

@romancitodev romancitodev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR adds a good feature, but don't rename config vars.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you renamed skip_preview?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I got this error:

thread 'main' panicked at ./.cargo/registry/src/index.crates.io-6f17d22bba15001f/clap_builder-4.5.2/src/builder/debug_asserts.rs:112:17:
Command simple-commits: Short option names must be unique for each argument, but '-s' is in use by both 'skip_preview' and 'skip_emojis'
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

where it clarifies that the variables cannot have the same short name. But another solution is to change the file src/config/mod.rs:50 with the following code:

pub struct GitConfig {
    /// Confirm before to run git commit
    #[arg(short = 'p', long = "skip-preview")]
    pub skip_preview: bool,

    /// Confirm before to run git commit
    #[arg(short = 'e', long = "skip-emojis")]
    pub skip_emojis: bool,

    /// Command to run after generate commit message
    #[clap(long, short)]
    #[merge(strategy = swap_option)]
    pub commit_template: Option<Vec<String>>,
}

and in this way maintain the name of the variables.

@ramiro-l ramiro-l requested a review from romancitodev July 3, 2024 16:56
@ramiro-l ramiro-l requested a review from romancitodev July 3, 2024 17:44
@romancitodev romancitodev merged commit 32a4713 into romancitodev:main Jul 3, 2024
7 of 8 checks passed
@romancitodev
Copy link
Owner

Congrats!

@ramiro-l ramiro-l deleted the fix-preview-and-emoji-skip branch July 4, 2024 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants