2 releases

0.0.2 Sep 12, 2022
0.0.1 Sep 12, 2022

#2479 in Development tools

GPL-3.0 license

20KB
320 lines

mkmod

Easily add modules to a Rust project.

Creates a new module in a Rust project. This is done by creating a file or directory based on the name of the module provided. The module can include a seperate test file, and be automatically added to its partent module.

Install

This requires cargo to be installed.

Run cargo +nightly install mkmod from your terminal.

Manual

Download the mkmod executable from the desired release and add it to your path.

Examples

File module

mkmod new_mod

Adds a new file module called new_mod to the current directory.

This will add the files new_mod.rs and new_mod_test.rs to the directory. new_mod.rs will contain testing boilerplate pointing to the new_mod_test.rs file.

new_mod will also be added as a public module to its parent.

Directory module

mkmod big_mod --dir

Adds a new directory module named big_mod to the current directory.

This will add a directory called big_mod to the current directory with files mod.rs and mod_test.rs. mod.rs will have testing boilerplate pointing to the mod_test.rs file.

Root module

mkmod my_mod --main

By default, modules added to the root directory will first try to be added to lib.rs. If lib.rs does not exist, they will then attempt to be added to main.rs. You can force a module to be added to main.rs using the --main flag.

Misc.

mkmod path/to/my_mod
mkmod my_mod --no-test
mkmod my_mod --no-add
mkmod my_mod --private

Dependencies

~5–14MB
~186K SLoC