2 releases
0.1.1 | Dec 24, 2024 |
---|---|
0.1.0 | Dec 24, 2024 |
#1219 in Command line utilities
236 downloads per month
11KB
165 lines
T-Box
T-Box is a command-line tool to manage file templates. It allows you to register templates, list all available templates, and create files from these templates with ease.
Features
- Register a template by providing its name and file path.
- List all registered templates.
- Create files from registered templates.
Installation
Prerequisites
-
Rust: Make sure you have Rust installed on your system. You can install Rust using the following command:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Build and Install
To install this CLI globally:
-
Clone the repository:
git clone https://github.com/your-username/t-box.git cd t-box
-
Install the CLI globally using Cargo:
cargo install --path .
-
Verify the installation:
t-box --help
Usage
Register a Template
To register a new template:
t-box register <template-name> <template-file-path>
Example:
t-box register solidity solidity_template.txt
List Registered Templates
To view all registered templates:
t-box list
Example Output:
Registered templates:
- solidity
- rust
Create a File from a Template
To create a file from a registered template:
t-box create <template-name> <target-file-path>
Example:
t-box create solidity example.sol
If the template solidity
is registered, the file example.sol
will be created with its content.
Development
Project Structure
src/
├── main.rs # Entry point of the application
├── cli.rs # Command-line argument parsing
├── template.rs # Template management logic
├── utils.rs # Utility functions (optional)
Running Locally
To run the project locally:
-
Clone the repository:
git clone https://github.com/your-username/t-box.git cd t-box
-
Run the project:
cargo run -- <command>
For example:
cargo run -- list
Testing
To run tests:
cargo test
Linting
Ensure the code follows Rust's style guidelines using rustfmt
:
cargo fmt
Contributing
Contributions are welcome! Please follow the steps below:
- Fork the repository.
- Create a new branch for your feature/bugfix.
- Make your changes and commit them with descriptive messages.
- Submit a pull request.
Code of Conduct
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.
License
This project is licensed under the MIT License.
Acknowledgments
Special thanks to the open-source community for providing inspiration and support. """
Writing the content to README.md
with open("README.md", "w") as file: file.write(readme_content)
"README.md has been successfully created!"
Dependencies
~1.6–3MB
~55K SLoC