1 unstable release
new 0.1.0 | Apr 17, 2025 |
---|
#2079 in Command line utilities
15KB
149 lines
ru-cpj
A Rust-based command-line tool for creating new projects from templates. This tool helps you quickly set up new projects by downloading and extracting templates from URLs, while handling all the necessary initialization steps.
Features
- Creates new project directories with specified names
- Initializes Git repositories
- Downloads and extracts project templates from URLs (supports .zip and .tar.gz formats)
- Automatically flattens directory structures
- Updates Cargo.toml with the new project name
- Runs initial cargo build to verify the setup
Installation
Prerequisites
- Rust and Cargo (Rust's package manager)
- Git
- unzip (for .zip files)
- tar (for .tar.gz files)
Building from Source
# Clone the repository
git clone https://github.com/yourusername/ru-cpj.git
cd ru-cpj
# Build the project
cargo build --release
# The binary will be available at target/release/ru-cpj
Usage
ru-cpj <project_name> <template_url>
Arguments
project_name
: The name of your new projecttemplate_url
: URL to the template archive (supports .zip and .tar.gz formats)
Example
# Create a new project named "my-project" from a template
ru-cpj my-project https://example.com/templates/rust-web-template.zip
This will:
- Create a new directory named "my-project"
- Initialize a Git repository
- Download and extract the template
- Update the project configuration
- Run an initial build
Supported Template Formats
- ZIP (.zip)
- TAR.GZ (.tar.gz, .tgz)
Error Handling
The tool includes comprehensive error handling and will provide clear error messages if something goes wrong during the process.
License
[Add your license information here]
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Dependencies
~5–17MB
~237K SLoC