::: :::::::: :::::::: ::: :::::::::::
:+: :+: :+: :+: :+: :+: :+:
+:+ +:+ +:+ +:+ +:+ +:+
+#+ +:+ +#+ +#+ +#+ +#+
+#+#+#+#+#+ +#+ +#+ +#+ +#+
#+# #+# #+# #+# #+# #+#
### ########## ######## ########## ###########
This is a simple CLI tool to manage, test and run your 42 projects.
bash
cargo install --git https://github.com/herbievine/42-cli.git
bash
cargo install ftcli
We recomment adding this line to your .bashrc or .zshrc to persist the ft alias.
bash
alias ft="ftcli"
When you have a config file present in your project, 42 CLI will attempt to run your command. There are a few speciad attributes which come with these commands, like installing MLX and executing a command in a specific directory.
You will need to create a 42-cli.toml file in each of your projects. This file will look something like this:
```toml
name = "push_swap"
[scripts] build = { cmd = "make" } run = [ { cmd = "./pushswap 8 2 -2 0 2147483647" }, { cmd = "./pushswap invalid :(" }, ] ```
Here, it is used in the so_long project. Each script is defined by an object (except run and test which contain an array of objects) with special keys to automate your development.
```toml name = "so_long"
[scripts] build = { cmd = "make", mlx = true, mlxdir = "minilibx" } run = [{ cmd = "./solong maps/small.ber" }] clean = { cmd = "make fclean", mlx = true, mlx_dir = "minilibx" } lint = { cmd = "norminette ." } ```
Here you have 4 scripts:
- build, which will run make after installing MLX in the minilibx directory.
- run, which will execute after running build (if present), and run ./so_long maps/small.ber (clean can also be run at the end. See API Reference below)
- clean, which will run make fclean, and then delete MLX.
- lint, which simply runs norminette on your code.
Here is also an example with ft_printf, which contains a test suite to execute:
```toml name = "ft_printf"
[scripts] build = { cmd = "make" } test = [ { cmd = "git clone https://github.com/Tripouille/printfTester.git tester" }, { cmd = "make m", dir = "tester" }, { cmd = "rm -rf tester" } ] clean = { cmd = "make fclean" } lint = { cmd = "norminette ." } ```
In this example, you will notice there is a test script, which executes the defined scripts one-by-one. The test script will execute the build script, and run the clean script after finishing (only if they are defined).
If you want to automate your deployements, or simply run commands on each of your projects in on command, you can create a config file in the head of your directory, like so:
42/
├─ libft/
│ ├─ 42-cli.toml
├─ ft_printf/
│ ├─ 42-cli.toml
├─ get_next_line/
│ ├─ 42-cli.toml
├─ 42-cli.toml
The root 42-cli.toml file should contain a key called projects, which all your projects defined as strings.
```toml name = "42" projects = [ "libft", "ftprintf", "getnext_line" ]
[scripts] ```
42 CLI will attempt to run your command in each of the defined projects, if it's not present, it will just skip it.
Note: the
runcommand cannot be run as root.
helpDisplays the help menu.
bash
ft help
buildBuild your project with the defined build scripts in the 42-cli.toml file.
bash
ft build
-s, --silent: Don't print the output of the build script.-h, --help: Print help.runRun your project with the defined commands in the 42-cli.toml file. It will first run the build script if defined.
bash
ft run
-s, --silent: Don't print the output of the run script.-c, --clean: Run the clean script defined in the 42-cli.toml file.-h, --help: Print help.testRun the test script defined in the 42-cli.toml file. It will first run the build script if defined, and run the clean script once the test is done (even if it fails).
bash
fourtytwo-cli test
-s, --silent: Don't print the output of the test script.-h, --help: Print help.cleanRun the clean script defined in the 42-cli.toml file.
bash
fourtytwo-cli clean
-s, --silent: Don't print the output of the clean script.-h, --help: Print help.lintRun the lint script defined in the 42-cli.toml file.
bash
fourtytwo-cli lint
-s, --silent: Don't print the output of the lint script.-h, --help: Print help.If you've found a bug or have a feature request, please open an issue. If you'd like to contribute, please open a pull request.