summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatan Kushner <hello@matchai.me>2019-04-02 00:45:49 -0400
committerMatan Kushner <hello@matchai.me>2019-04-02 00:45:49 -0400
commit41ee54933bd2820b1ba97726514f785f1ac73824 (patch)
tree1d7fea41b4ffc43bbcf000bdcfeaa86c0071e5e9 /src
parent4e1ae0662234bca85837fe136d0ab997b917c835 (diff)
Start working on char color for status
Diffstat (limited to 'src')
-rw-r--r--src/char.rs20
-rw-r--r--src/main.rs9
2 files changed, 28 insertions, 1 deletions
diff --git a/src/char.rs b/src/char.rs
new file mode 100644
index 000000000..7d0998b4a
--- /dev/null
+++ b/src/char.rs
@@ -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));
+}
diff --git a/src/main.rs b/src/main.rs
index 17c57862d..8a6cd5fd7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -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);
}