Crate prsm

Source
Expand description

§PRSM - Project Script Manager

prsm (pronounced “prism”) aims to speed up the process of writing simple project management CLI applications. It’s common to have a custom suite of formatting, linting, and debugging scripts in separate shell/scripting files. However, for those interested in using Rust for these purposes, it can be daunting to set up their scripts compared to others who use simpler languages such as Python.

The intent of prsm is to reduce any and all complexity of setting up the script manager so you, the developer, can focus more time and energy into your management scripts. You’re already using Rust rather than the simpler alternatives. Why introduce even more complexity into your life?

Using prsm is easy thanks to the prsm macro.

use prsm::prsm;

fn format() -> Result<(), std::io::Error> { Ok(()) }
fn lint() -> Result<(), std::io::Error> { Ok(()) }

let script_manager = prsm! {
    [1] "Format repository files" => format(),
    [2] "Lint Rust files" => lint()
};

script_manager.run();

Note that prsm is a library dedicated to abstracting away the setup process of a script manager. It is not interested in the explicit returns that you may have for your functions that manage your project. It’s best to use stateless functions for prsm that do not have meaningful return values, as prsm will throw away any return value (other than errors, which are returned for debugging purposes).

Modules§

prelude
Import this to include all necessary prsm features to get your script manager up and running.

Macros§

prsm
Generates a ScriptManager.
prsm_script
Generates a Script.

Structs§

Script
A prsm script that can be called through the ScriptManager.
ScriptManager
A named script manager (defaults to “ScriptManager”). When ran, the manager displays a mapping of functions that can be called to perform tasks. The scripts can be given descriptions that will display in the run menu along with their option ID. If you wish to include a script that has no error condition, rather than void the usage of the Result type, please use Infallible.

Traits§

PrsmDisplay
A displayable type that can be both displayed (for error handling) and debugged (for unwrapping).

Type Aliases§

ScriptResult
The required return type for prsm functions. If you wish to explicitly declare your return type as one that does not fail, please use Infallible.