mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
Start working on char color for status
This commit is contained in:
+20
@@ -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));
|
||||
}
|
||||
+8
-1
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user