From e519c3f4a6ff633eb049f7fa57a3c06e032466b2 Mon Sep 17 00:00:00 2001 From: Matan Kushner Date: Wed, 3 Apr 2019 22:57:50 -0400 Subject: Set status with arg rather than env --- src/main.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index ab7e04e56..7cbe7d225 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,7 +6,7 @@ mod modules; mod print; use ansi_term::Style; -use clap::App; +use clap::{App, Arg}; pub struct Segment { style: Style, @@ -16,14 +16,19 @@ pub struct Segment { } fn main() { - App::new("Starship") + let args = App::new("Starship") .about("The cross-platform prompt for astronauts. ✨🚀") // pull the version number from Cargo.toml .version(crate_version!()) // pull the authors from Cargo.toml .author(crate_authors!()) .after_help("https://github.com/matchai/starship") + .arg( + Arg::with_name("status_code") + .help("The status code of the previously run command") + .required(true), + ) .get_matches(); - print::prompt(); + print::prompt(args); } -- cgit v1.2.3