Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martan03/makeit
Utility for creating and loading templates
https://github.com/martan03/makeit
cli-utility makeit rust templates
Last synced: about 1 month ago
JSON representation
Utility for creating and loading templates
- Host: GitHub
- URL: https://github.com/martan03/makeit
- Owner: Martan03
- License: gpl-3.0
- Created: 2024-04-08T09:51:27.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-06-09T20:09:51.000Z (7 months ago)
- Last Synced: 2024-06-09T21:34:48.516Z (7 months ago)
- Topics: cli-utility, makeit, rust, templates
- Language: Rust
- Homepage:
- Size: 241 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![Makeit thumbnail](assets/thumbnail-small.png)
# makeit
Utility for creating and loading templates
## Table of Contents
- [Installation](#installation)
- [AUR package](#aur-package)
- [Compile it your own](#compile-it-your-own)
- [Usage](#usage)
- [Loading templates](#loading-templates)
- [Creating template](#creating-template)
- [Other usage](#other-usage)
- [Detailed description](#detailed-description)
- [Custom expression language](#custom-expression-language)
- [Variables](#variables)
- [Internal variables](#internal-variables)
- [Literals](#literals)
- [Operators](#operators)
- [Operator +](#operator-)
- [Operator ==](#operator-)
- [Operator ??](#operator-)
- [Technologies](#technologies)
- [Links](#links)## Installation
### AUR package
`makeit` is available as an
[AUR package](https://aur.archlinux.org/packages/makeit). You can install it
with any AUR package manager. This is example installation with
[`yay`](https://github.com/Jguer/yay):```
yay -S makeit
```### Compile it your own
You can also clone this repo and compile it yourself. But that shouldn't be a
problem, since only thing you need is `cargo`:
```
cargo build -r
```
After it's done compiling, you can start it in `./target/release/makeit`## Usage
### Loading templates
You can load already existing template. If you don't specify `-d`, template
will be loaded to current directory by default:
```
./makeit [-d load/template/to]
```### Creating template
To create template you have to do this (note that if `-d` isn't specified,
template is create from current directory):
```
./makeit -c [-d create/template/from]
```### Other usage
To see full usage and other options, visit `makeit` help or `man-page`:
```
./makeit -h
```## Detailed description
### Custom expression language
For parametrization of the templates I created custom expression language.
Expressions are enclosed in `{{` and `}}`.#### Variables
- Can be defined in `makeit.json` file of the template or supplied using
command-line arguments
- Name has to start with alphabetic character or underscore and is followed
by any alphanumeric character or underscore##### Internal variables
- `_PNAME`: project name based on project directory
- `_PDIR`: project directory
- `_OS`: operatins system#### Literals
- Enclosed in double quotes (")
- They support escape sequences:
- `\n`: newline
- `\r`: carriage return
- `\t`: tabulator
- `\\`: backslash
- `\"`: double quotes
- Other sequences are expanded to character following backslash#### Operators
##### Operator +
- Variables and literals concatenation
- Combines them to single literal
- Syntax:
- `EXPR1 + EXPR2`##### Operator ==
- Compares two values for equality (`true` when equals, else `false`)
- Syntax:
- `EXPR1 == EXPR2`##### Operator ??
- The null coalescing operator - provides default value for an expression,
which evaluates to `null`
- Syntax:
- `EXPR1 ?? EXPR2`: returns value of `EXPR1` of not `null` else value of
`EXPR2`## Technologies
I used these libraries, which were really helpful:
- [dirs](https://crates.io/crates/dirs)
- Accessing config folder
- [serde](https://crates.io/crates/serde)
- Saving and loading to JSON
- [termint](https://crates.io/crates/termint)
- Colored printing## Links
- **Author:** [Martan03](https://github.com/Martan03)
- **GitHub repository:** [termint](https://github.com/Martan03/makeit)
- **Author website:** [martan03.github.io](https://martan03.github.io)