::: :::::::: :::::::: ::: ::::::::::: :+: :+: :+: :+: :+: :+: :+: +:+ +:+ +:+ +:+ +:+ +:+ +#+ +:+ +#+ +#+ +#+ +#+ +#+#+#+#+#+ +#+ +#+ +#+ +#+ #+# #+# #+# #+# #+# #+# ### ########## ######## ########## ###########
This is a simple CLI tool to manage, test and run your 42 projects.
- Rust
- Norminette (Optional)
cargo install --git https://github.com/herbievine/42-cli.git
cargo install ftcli
We recomment adding this line to your .bashrc
or .zshrc
to persist the ft
alias.
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:
# The name of the project
name = "push_swap"
[scripts]
build = { cmd = "make" }
run = [
{ cmd = "./push_swap 8 2 -2 0 2147483647" },
{ cmd = "./push_swap 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.
name = "so_long"
[scripts]
build = { cmd = "make", mlx = true, mlx_dir = "minilibx" }
run = [{ cmd = "./so_long maps/small.ber" }]
clean = { cmd = "make fclean", mlx = true, mlx_dir = "minilibx" }
lint = { cmd = "norminette ." }
Here you have 4 scripts:
build
, which will runmake
after installing MLX in theminilibx
directory.run
, which will execute after runningbuild
(if present), and run./so_long maps/small.ber
(clean
can also be run at the end. See API Reference below)clean
, which will runmake 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:
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.
name = "42"
projects = [
"libft",
"ft_printf",
"get_next_line"
]
# Leave this empty
[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
run
command cannot be run as root.
Displays the help menu.
ft help
Build your project with the defined build
scripts in the 42-cli.toml
file.
ft build
-s, --silent
: Don't print the output of the build script.-h, --help
: Print help.
Run your project with the defined commands in the 42-cli.toml
file. It will first run the build
script if defined.
ft run
-s, --silent
: Don't print the output of the run script.-c, --clean
: Run the clean script defined in the42-cli.toml
file.-h, --help
: Print help.
Run 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).
fourtytwo-cli test
-s, --silent
: Don't print the output of the test script.-h, --help
: Print help.
Run the clean script defined in the 42-cli.toml
file.
fourtytwo-cli clean
-s, --silent
: Don't print the output of the clean script.-h, --help
: Print help.
Run the lint script defined in the 42-cli.toml
file.
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.