From cfb017c6cc8b3df259a3598d5d21257c8edf75d3 Mon Sep 17 00:00:00 2001 From: longjin Date: Sat, 25 Apr 2026 23:43:09 +0800 Subject: [PATCH] chore: bump version to 0.7.3 and update installation instructions - Update version in Cargo.toml and Cargo.lock to 0.7.3 - Modify installation commands in README and README_CN to reflect the new version - Enhance documentation for the `--branch-prefix` option to include its alias `--bp` - Add tests for branch prefix alias functionality Signed-off-by: longjin --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 4 ++-- README_CN.md | 4 ++-- src/animation.rs | 4 ++-- src/cli.rs | 36 +++++++++++++++++++++++++++++++++++- 6 files changed, 43 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a6c1f52..3fc584d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -330,7 +330,7 @@ dependencies = [ [[package]] name = "fastcommit" -version = "0.7.2" +version = "0.7.3" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index e6337b5..42e5c10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fastcommit" -version = "0.7.2" +version = "0.7.3" description = "AI-based command line tool to quickly generate standardized commit messages." edition = "2021" authors = ["longjin "] diff --git a/README.md b/README.md index 11892a5..ac391e4 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ You can install `fastcommit` using the following method: ```bash # Install using cargo -cargo install --git https://github.com/fslongjin/fastcommit --tag v0.7.2 +cargo install --git https://github.com/fslongjin/fastcommit --tag v0.7.3 ``` @@ -31,7 +31,7 @@ NOTE: All common config can be configured via `~/.fastcommit/config.toml` - `--conventional `: Enable or disable conventional commit style analysis. Acceptable values are `true` or `false`. - `-l, --language `: Specify the language for the commit message. Acceptable values are `en` (English) or `zh` (Chinese). - `-b, --generate-branch`: Generate branch name. - - `--branch-prefix`: prefix of the generated branch name + - `--branch-prefix `, `--bp `: prefix of the generated branch name - `-m, --message`: Generate commit message (use with -b to output both) - `-v, --verbosity `: Set the detail level of the commit message. Acceptable values are `verbose` (detailed), `normal`, or `quiet` (concise). The default is `quiet`. - `-p, --prompt `: Additional prompt to help AI understand the commit context. diff --git a/README_CN.md b/README_CN.md index 7a03b86..ae8b92a 100644 --- a/README_CN.md +++ b/README_CN.md @@ -8,7 +8,7 @@ ```bash # 使用 cargo 安装 -cargo install --git https://github.com/fslongjin/fastcommit --tag v0.7.2 +cargo install --git https://github.com/fslongjin/fastcommit --tag v0.7.3 ``` ## 使用 @@ -28,7 +28,7 @@ NOTE: All common config can be configured via `~/.fastcommit/config.toml` - `--conventional `: 启用或禁用规范提交风格分析。可选值为 `true` 或 `false`。 - `-l, --language `: 指定提交信息的语言。可选值为 `en`(英文)或 `zh`(中文)。 - `-b, --generate-branch`: 生成分支名 - - `--branch-prefix`: 生成的分支名的前缀 + - `--branch-prefix `, `--bp `: 生成的分支名的前缀 - `-m, --message`: 生成提交信息(与 -b 一起使用可同时输出) - `-v, --verbosity `: 设置提交信息的详细级别。可选值为 `verbose`(详细)、`normal`(正常)或 `quiet`(简洁)。 默认为 `quiet`。 - `-p, --prompt `: 额外的提示信息,帮助 AI 理解提交上下文。 diff --git a/src/animation.rs b/src/animation.rs index 7046806..9fe8986 100644 --- a/src/animation.rs +++ b/src/animation.rs @@ -10,8 +10,8 @@ const RANDOM_PHRASES: &[&str] = &[ "🌈 生成彩虹般绚丽的提交信息...", "⚡ 闪电般快速分析代码...", "🎨 为你的代码添加艺术气息...", - "🕺 Gee Kee Tai May! Oh Baby! ", - "💃 Gee Kee 实在是太美! ", + "🕺 Gee Knee Tai May! Oh Baby! ", + "💃 Gee Knee 实在是太美! ", "🎪 代码马戏团表演中...", "🍵 喝杯茶,马上就好...", "🎸 为代码变更谱写乐章...", diff --git a/src/cli.rs b/src/cli.rs index eb3cead..28c57ae 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -97,7 +97,11 @@ pub struct CommitArgs { )] pub generate_branch: bool, - #[clap(long, help = "Override branch prefix (default from config)")] + #[clap( + long, + visible_alias = "bp", + help = "Override branch prefix (default from config)" + )] pub branch_prefix: Option, #[clap( @@ -265,6 +269,36 @@ mod tests { ); } + #[test] + fn test_branch_prefix_alias_top_level() { + let args = parse_args(["fastcommit", "--bp=feature/"]).unwrap(); + assert!(args.command.is_none()); + assert_eq!(args.commit_args.branch_prefix, Some("feature/".to_string())); + assert!(!args.commit_args.generate_branch); + } + + #[test] + fn test_branch_prefix_alias_commit_subcommand() { + let args = parse_args(["fastcommit", "commit", "-b", "--bp=feature/"]).unwrap(); + if let Some(Commands::Commit(commit_args)) = args.command { + assert!(commit_args.generate_branch); + assert_eq!(commit_args.branch_prefix, Some("feature/".to_string())); + } else { + panic!("Expected Commit subcommand"); + } + } + + #[test] + fn test_prompt_short_option_still_works_with_generate_branch() { + let args = parse_args(["fastcommit", "-b", "-p", "extra context"]).unwrap(); + assert!(args.commit_args.generate_branch); + assert_eq!( + args.commit_args.common.prompt, + Some("extra context".to_string()) + ); + assert_eq!(args.commit_args.branch_prefix, None); + } + #[test] fn test_auto_commit_option() { // Test: fastcommit -c (auto commit after generating)