1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-24 13:47:38 +00:00

Start working on char color for status

This commit is contained in:
Matan Kushner 2019-04-02 00:45:49 -04:00
parent 4e1ae06622
commit 41ee54933b
No known key found for this signature in database
GPG Key ID: 4B98C3A8949CA8A4
4 changed files with 30 additions and 1 deletions

1
Cargo.lock generated
View File

@ -57,6 +57,7 @@ dependencies = [
name = "starship"
version = "0.1.0"
dependencies = [
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

View File

@ -6,3 +6,4 @@ edition = "2018"
[dependencies]
clap = "2.32.0"
ansi_term = "0.11.0"

20
src/char.rs Normal file
View File

@ -0,0 +1,20 @@
use std::env;
use ansi_term::Color;
pub fn display() {
let PROMPT_CHAR = "";
let COLOR_SUCCESS = Color::Green;
let COLOR_FAILURE = Color::Red;
let color = match env::var_os("status") {
None | "0" => COLOR_SUCCESS,
_ => COLOR_FAILURE
};
// let color = match env::var("status") {
// Ok("0") | _ => COLOR_SUCCESS,
// Ok("1") => COLOR_FAILURE
// };
print!("{}", color.paint(PROMPT_CHAR));
}

View File

@ -1,13 +1,20 @@
#[macro_use]
extern crate clap;
use clap::App;
use std::io;
mod char;
fn main() {
let matches = App::new("Starship")
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!())
.get_matches();
prompt::char();
// let stdout = io::stdout();
// let mut handle = io::BufWriter::new(stdout);
}