forked from xcambar/purs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite the prompt to accept arguments
- Loading branch information
Showing
2 changed files
with
37 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
use std::env; | ||
const INSERT_SYMBOL:&str = "❯"; | ||
const COMMAND_SYMBOL:&str = "⬢"; | ||
|
||
const SYMBOL:&str = "❯"; | ||
|
||
pub fn display() { | ||
let var = env::var("_LAST_RETURN_STATUS"); | ||
let last_command = match var { | ||
Ok(val) => val.parse::<u8>().unwrap(), | ||
Err(_e) => 1 | ||
pub fn display(return_code: &str, keymap: &str) { | ||
let symbol = match keymap { | ||
"vicmd" => COMMAND_SYMBOL, | ||
_ => INSERT_SYMBOL, | ||
}; | ||
|
||
let shell_color = match last_command { | ||
0 => 5, | ||
let shell_color = match (symbol, return_code) { | ||
(COMMAND_SYMBOL, _) => 3, | ||
(_, "0") => 5, | ||
_ => 9, | ||
}; | ||
|
||
print!("%F{{{}}}{}%f", shell_color, SYMBOL); | ||
print!("%F{{{}}}{}%f ", shell_color, symbol); | ||
} |