mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 20:19:40 +00:00
feat: update help flag
This commit is contained in:
@@ -34,9 +34,12 @@ pub struct AddArgs {
|
||||
}
|
||||
|
||||
pub fn add(args: &[String]) -> i32 {
|
||||
if args.first().map_or(false, |a| a == "--help") {
|
||||
if args.first().is_some_and(|a| a == "--help") {
|
||||
printc("USAGE:", BOLD_GREEN);
|
||||
printc(" dcr add <name> <source> [--branch <b>] [--tag <t>] [--rev <r>]", BOLD_CYAN);
|
||||
printc(
|
||||
" dcr add <name> <source> [--branch <b>] [--tag <t>] [--rev <r>]",
|
||||
BOLD_CYAN,
|
||||
);
|
||||
println!();
|
||||
printc("DESCRIPTION:", BOLD_GREEN);
|
||||
println!(" Adds a dependency to the project.");
|
||||
|
||||
@@ -42,9 +42,12 @@ static BUILD_INTERRUPTED: AtomicBool = AtomicBool::new(false);
|
||||
static SIGNAL_HANDLER: Once = Once::new();
|
||||
|
||||
pub fn build(args: &[String]) -> i32 {
|
||||
if args.first().map_or(false, |a| a == "--help") {
|
||||
if args.first().is_some_and(|a| a == "--help") {
|
||||
printc("USAGE:", BOLD_GREEN);
|
||||
printc(" dcr build [--debug | --release] [--target <triple>] [--force] [--clean] [--verbose]", BOLD_CYAN);
|
||||
printc(
|
||||
" dcr build [--debug | --release] [--target <triple>] [--force] [--clean] [--verbose]",
|
||||
BOLD_CYAN,
|
||||
);
|
||||
println!();
|
||||
printc("DESCRIPTION:", BOLD_GREEN);
|
||||
println!(" Compiles the project. Default profile is --debug.");
|
||||
|
||||
@@ -27,9 +27,12 @@ use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn clean(args: &[String]) -> i32 {
|
||||
if args.first().map_or(false, |a| a == "--help") {
|
||||
if args.first().is_some_and(|a| a == "--help") {
|
||||
printc("USAGE:", BOLD_GREEN);
|
||||
printc(" dcr clean [--debug | --release] [--target <triple>] [--all]", BOLD_CYAN);
|
||||
printc(
|
||||
" dcr clean [--debug | --release] [--target <triple>] [--all]",
|
||||
BOLD_CYAN,
|
||||
);
|
||||
println!();
|
||||
printc("DESCRIPTION:", BOLD_GREEN);
|
||||
println!(" Removes build artifacts from the target directory.");
|
||||
|
||||
@@ -40,7 +40,7 @@ struct ReleaseAsset {
|
||||
}
|
||||
|
||||
pub fn flag_update(args: &[String]) -> i32 {
|
||||
if args.first().map_or(false, |a| a == "--help") {
|
||||
if args.first().is_some_and(|a| a == "--help") {
|
||||
printc("USAGE:", BOLD_GREEN);
|
||||
printc(" dcr --update", BOLD_CYAN);
|
||||
println!();
|
||||
|
||||
@@ -21,7 +21,7 @@ use glob::glob;
|
||||
use std::process::Command;
|
||||
|
||||
pub fn fmt(args: &[String]) -> i32 {
|
||||
if args.first().map_or(false, |a| a == "--help") {
|
||||
if args.first().is_some_and(|a| a == "--help") {
|
||||
printc("USAGE:", BOLD_GREEN);
|
||||
printc(" dcr fmt", BOLD_CYAN);
|
||||
println!();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::config::FILE_MAIN_C;
|
||||
use crate::core::config::{validate_package_name, Config};
|
||||
use crate::core::config::{Config, validate_package_name};
|
||||
use crate::utils::fs::check_dir;
|
||||
use crate::utils::log::{error, warn};
|
||||
use crate::utils::text::{BOLD_CYAN, BOLD_GREEN, colored, printc};
|
||||
@@ -25,7 +25,7 @@ use std::io::Write;
|
||||
use toml::Value;
|
||||
|
||||
pub fn init(args: &[String]) -> i32 {
|
||||
if args.first().map_or(false, |a| a == "--help") {
|
||||
if args.first().is_some_and(|a| a == "--help") {
|
||||
printc("USAGE:", BOLD_GREEN);
|
||||
printc(" dcr init", BOLD_CYAN);
|
||||
println!();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::config::FILE_MAIN_C;
|
||||
use crate::core::config::{validate_package_name, Config};
|
||||
use crate::core::config::{Config, validate_package_name};
|
||||
use crate::utils::fs::check_dir;
|
||||
use crate::utils::log::{error, warn};
|
||||
use crate::utils::text::{BOLD_CYAN, BOLD_GREEN, colored, printc};
|
||||
@@ -25,7 +25,7 @@ use std::io::Write;
|
||||
use toml::Value;
|
||||
|
||||
pub fn new(args: &[String]) -> i32 {
|
||||
if args.first().map_or(false, |a| a == "--help") {
|
||||
if args.first().is_some_and(|a| a == "--help") {
|
||||
printc("USAGE:", BOLD_GREEN);
|
||||
printc(" dcr new <name>", BOLD_CYAN);
|
||||
println!();
|
||||
|
||||
@@ -56,9 +56,12 @@ fn get_run_cmd(
|
||||
}
|
||||
|
||||
pub fn run(args: &[String]) -> i32 {
|
||||
if args.first().map_or(false, |a| a == "--help") {
|
||||
if args.first().is_some_and(|a| a == "--help") {
|
||||
printc("USAGE:", BOLD_GREEN);
|
||||
printc(" dcr run [--debug | --release] [--target <triple>] [--force] [--clean] [--verbose]", BOLD_CYAN);
|
||||
printc(
|
||||
" dcr run [--debug | --release] [--target <triple>] [--force] [--clean] [--verbose]",
|
||||
BOLD_CYAN,
|
||||
);
|
||||
println!();
|
||||
printc("DESCRIPTION:", BOLD_GREEN);
|
||||
println!(" Builds and runs the project. Only available for kind = \"bin\".");
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
use crate::utils::text::{BOLD_CYAN, BOLD_GREEN, printc};
|
||||
|
||||
pub fn setup(args: &[String]) -> i32 {
|
||||
if args.first().map_or(false, |a| a == "--help") {
|
||||
if args.first().is_some_and(|a| a == "--help") {
|
||||
printc("USAGE:", BOLD_GREEN);
|
||||
printc(" dcr setup", BOLD_CYAN);
|
||||
println!();
|
||||
|
||||
@@ -23,7 +23,7 @@ use std::path::{Path, PathBuf};
|
||||
use toml::Value;
|
||||
|
||||
pub fn tree(args: &[String]) -> i32 {
|
||||
if args.first().map_or(false, |a| a == "--help") {
|
||||
if args.first().is_some_and(|a| a == "--help") {
|
||||
printc("USAGE:", BOLD_GREEN);
|
||||
printc(" dcr tree", BOLD_CYAN);
|
||||
println!();
|
||||
|
||||
Reference in New Issue
Block a user