MK-Template is a command-line application that facilitates the creation and management of project, files and directory templates. It allows users to automate the creation of repetitive structures with predefined templates.
Basic Knowledge:
- The application is written in Rust.
- The configuration is saved in $MKT_HOME. If $MKT_HOME is not defined, ~/.mkt will be used instead.
- Templates are saved in $MKT_HOME/templates, known as the templates' directory. The application always saves a file with the template's data and, sometimes, the template itself in this directory.
Right now, the application is in development and supports 3 types of templates:
- Directories: You can save an entire directory as a template. The entire directory will be copied into the template's directory if you use the -as-dir flag. Otherwise, it will be converted into a TXML template and saved in that format. Note: If the dir contains some binary content, the template will always be saved the same way as if the -as-dir flag was used.
- Git: A .git directory or link to be cloned. The application will use git clone to the path you provide. If the path becomes unavailable, git clone will fail.
- TXML: An XML file that defines the template structure. The application will read the XML file and, if it is valid, save it in the template's directory. This type of template won't include binaries, whereas a Dir Template would.
-
Clone the repository and navigate into it.:
$ git clone https://github.com/ZocoLini/mk-template.git; $ cd mk-template;
-
Compile and install the binary (Need cargo installed):
-
Linux: You have a installer.sh file that you can run. The binary will be copied to
~/-local/bin
$ chmod +x installer.sh; $ ./installer.sh;
-
Windows: You have a installer.bat file that you can run. The binary will be copied to
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps
> installer.bat
- MacOS: You have to compile and install the package manually.
$ mkt [COMMAND] [OPTIONS]
mkt [add -p <Path to the template you want to add> [-n <Custom name for the template>] [-as-dir]],
[list [-d]],
[rm -n <Name of the template you want to remove>]],
[spawn -n <Name of the template you want to spawn> [-o <Define an output name>]],
[help],
[version]
Add a template:
$ mkt add -p default-templates/txml.xml # Add a TXML template as txml
$ mkt add -p default-templates/txml.xml -n template # Add a TXML template as template
$ mkt add -p crates/ # Add a directory as crates
$ mkt add -p crates/ -n my-crates # Add a directory as my-crates
$ mkt add -p https://github.com/ZocoLini/mk-template.git # Add a git repository as mk-template
$ mkt add -p https://github.com/ZocoLini/mk-template.git -n mkt_repo # Add a git repository as mkt_repo
Spawn a template:
$ mkt spawn -n txml # Spawn the txml template
$ mkt spawn -n txml -o my-txml # Spawn the txml template as my-txml
Remove a template:
$ mkt rm -n txml # Remove the txml template
$ mkt rm -n my-crates # Remove the my-crates template
TXML is a simple XML format that defines the structure of a template. It is used to create templates that can be spawned using the MK-Template application. The TXML schema is available at lebastudios.org.
Visit the TXML Documentation for more information on how to use TXML.
Contributions are welcome! If you'd like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes and commit them (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
Please make sure your code adheres to the following guidelines:
- Write clear and concise commit messages.
- Ensure that your code follows the project's style guidelines.
- Add comments where necessary for clarity.
- Test your changes to ensure they don't break existing functionality.
If you find a bug or have a feature request, feel free to open an issue.
Thank you for your contributions!
This project is licensed under the MIT License - see the LICENSE file for details.