coliru

A minimal, flexible, dotfile installer
git clone https://git.ashermorgan.net/coliru/
Log | Files | Refs | README

commit 0a3097cd10e54925d1c3d7bfe592b7c44f8a0353
parent b3b68147f60106e4829777a33ffbe3101cad8540
Author: Asher Morgan <59518073+ashermorgan@users.noreply.github.com>
Date:   Thu, 20 Jun 2024 13:55:03 -0700

Create cli::run function

Diffstat:
Msrc/cli.rs | 16+++++++++++++---
Msrc/main.rs | 6+-----
2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/cli.rs b/src/cli.rs @@ -1,9 +1,12 @@ use clap::{Parser, ColorChoice}; +use std::path::Path; +use super::core::execute_manifest_file; -/// A minimal, flexible, dotfile installer +/// Stores arguments to the coliru CLI #[derive(Parser, Debug)] -#[command(version, color=ColorChoice::Never)] -pub struct CLI { +#[command(version, color=ColorChoice::Never, + about="A minimal, flexible, dotfile installer")] +struct Args { /// The path to the coliru YAML manifest file pub manifest: String, @@ -15,3 +18,10 @@ pub struct CLI { #[arg(short = 'n', long)] pub dry_run: bool, } + +/// Runs the coliru CLI +pub fn run() { + let args = Args::parse(); + let manifest_path = Path::new(&args.manifest); + execute_manifest_file(&manifest_path, args.tag_rules, args.dry_run); +} diff --git a/src/main.rs b/src/main.rs @@ -4,10 +4,6 @@ mod manifest; mod tags; mod utils; -use clap::Parser; - fn main() { - let args = cli::CLI::parse(); - let manifest_path = std::path::Path::new(&args.manifest); - core::execute_manifest_file(&manifest_path, args.tag_rules, args.dry_run); + cli::run(); }