Chief
Chief Development Tools is a Rust library that provides a command-line interface (CLI) along with utilities for logging and managing environment variables. This tool simplifies the processes associated with developing and managing web applications.
Table of Contents
- Features
- Getting Started
- Commands
- Logging
- Environment Variables
- Usage Examples
- License
- Contributing
- Author
Features
- CLI for Application Management: Easily run applications in development or production mode and execute tests.
- Integrated Logging: Utilize the
logcrate for logging at various levels and configure with thesimplelogcrate for easy setup. - Environment Variable Management: Access standard environment variables effortlessly.
Getting Started
Installation
Run the following Cargo command in your project directory:
cargo add chief
or add chief to your Cargo.toml file:
[]
= "MAJOR.MINOR.PATCH" # Replace with the latest version
Building from Source
To build the Chief Development Tools from source, follow these commands:
git clone https://github.com/dr-montasir/chief.git
cd chief
cargo build --release
Commands
The following subcommands are available in the CLI:
-
run: Runs the application.run dev: Runs the application in development mode.run prod: Runs the application in production mode.
-
test: Runs the tests for the application.
Logging
Chief Development Tools uses the log crate to facilitate logging functionalities. You can set up logging simply in your main application:
use ;
use ;
Environment Variables
Accessing environment variables in your application can be done using the chief::{dotenv, env} modules. Here is a simple way to get an environment variable:
# .env file
MY_ENV_VARIABLE=my_variable
use ;
// Output:
// My environment variable is: my_variable
Usage Examples
To run the application in development mode:
chief run dev
To run the application in production mode:
chief run prod
To execute tests:
chief test
License
This project is licensed under either of the following licenses:
- MIT License
- Apache License, Version 2.0
You may choose either license for your purposes.
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue for any feature requests or bug reports.