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:
parent
4e1ae06622
commit
41ee54933b
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -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)",
|
||||
]
|
||||
|
||||
|
@ -6,3 +6,4 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
clap = "2.32.0"
|
||||
ansi_term = "0.11.0"
|
||||
|
20
src/char.rs
Normal file
20
src/char.rs
Normal 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));
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user