Skip to content

Conversation

@gomnitrix
Copy link
Contributor

Add scripts to rename template project to user-defined project name:

  • rename-project.sh for Linux/macOS
  • rename-project.ps1 for Windows PowerShell

The scripts update:

  • Project name in Cargo.toml and package Cargo.toml
  • GitHub repository URLs in README.md and semantic.yml
  • Crates.io and docs.rs URLs in README.md
  • Badge URLs in README.md
  • Source directory name (template/ -> \<project-name\>/)
  • Cargo.lock package name

Resolves #4


Note: Developed with assistance from AI tools; manual tests performed on macOS/Linux/Windows.

@gomnitrix gomnitrix changed the title feat: add batch rename scripts for project initialization #4 feat: add batch rename scripts for project initialization Nov 30, 2025
@tisonkun tisonkun self-requested a review December 5, 2025 22:47
@tisonkun
Copy link
Contributor

tisonkun commented Dec 5, 2025

Thanks for your contribution! You can ping me the next time or I may miss the updates.

Add cross-platform scripts to rename template project to user's project name: - rename-project.sh for Linux/macOS (with macOS sed compatibility) - rename-project.ps1 for Windows PowerShell  The scripts update: - Project name in Cargo.toml and package Cargo.toml - GitHub repository URLs in README.md and semantic.yml - Crates.io and docs.rs URLs in README.md - Badge URLs in README.md - Source directory name (template/ -> <project-name>/) - Cargo.lock package name (direct replacement for speed)
@tisonkun
Copy link
Contributor

tisonkun commented Dec 5, 2025

@gomnitrix Generally looks good.

Would you like to port the logic in xtask/src/main.rs? Then we can avoid depending on Shell/PowerShell knowledge and you may want to learn Rust and leverage the Rust (clap-rs, cli) ecosystem for more.

You can start with the following command and perhaps add a new bootstrap subcommand.

#[derive(Subcommand)]
enum SubCommand {
#[clap(about = "Compile workspace packages.")]
Build(CommandBuild),
#[clap(about = "Run format and clippy checks.")]
Lint(CommandLint),
#[clap(about = "Run unit tests.")]
Test(CommandTest),
}
#[derive(Parser)]
struct CommandBuild {
#[arg(long, help = "Assert that `Cargo.lock` will remain unchanged.")]
locked: bool,
}
impl CommandBuild {
fn run(self) {
run_command(make_build_cmd(self.locked));
}
}

@tisonkun
Copy link
Contributor

tisonkun commented Dec 6, 2025

I'd merge this patch first and leave the suggestion above a follow-up idea.

@tisonkun tisonkun merged commit e098fe0 into fast:main Dec 6, 2025
9 checks passed
@gomnitrix
Copy link
Contributor Author

@tisonkun Thanks for merging this PR!

I’d be happy to move the logic into xtask. I wasn’t sure at first whether this should live as a shell script, and since the issue title mentioned “script”, I assumed a lightweight one-off tool was what you had in mind. I probably should’ve asked for clarification earlier, that’s on me 😵

Now that the direction is clear, I’ll start working on a proper xtask subcommand.

Thanks again for the helpful feedback and for being so encouraging.

@gomnitrix gomnitrix deleted the dev_rename_script branch December 7, 2025 00:24
@tisonkun
Copy link
Contributor

tisonkun commented Dec 7, 2025

Go ahead!

.. and thanks for your time and contribution :D

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.

Add a script for batch renames

2 participants