Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add title bar setting, add ability to produce any character using hex code #647

Merged
merged 1 commit into from Dec 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/shell/variables/mod.rs
Expand Up @@ -34,7 +34,7 @@ impl Default for Variables {
map.insert("HISTFILE_SIZE".into(), "1000".into());
map.insert(
"PROMPT".into(),
"${c::0x55,bold}${USER}${c::default}:${c::0x4B}${SWD}${c::default}# ${c::reset}".into(),
"${x::1B}]0;${USER}: ${PWD}${x::07}${c::0x55,bold}${USER}${c::default}:${c::0x4B}${SWD}${c::default}# ${c::reset}".into(),
);
// Set the PID variable to the PID of the shell
let pid = getpid()
Expand Down Expand Up @@ -223,6 +223,15 @@ impl Variables {
// designated. Find it.
match name {
"c" | "color" => Colors::collect(variable).into_string(),
"x" | "hex" => match u8::from_str_radix(variable, 16) {
Ok(c) => {
Some((c as char).to_string())
},
Err(why) => {
eprintln!("ion: hex parse error: {}: {}", variable, why);
None
}
},
"env" => env::var(variable).map(Into::into).ok(),
_ => {
if is_root() {
Expand All @@ -246,7 +255,7 @@ impl Variables {
match namespace.execute(variable.into()) {
Ok(value) => value.map(Into::into),
Err(why) => {
eprintln!("ion: string namespace erorr: {}: {}", name, why);
eprintln!("ion: string namespace error: {}: {}", name, why);
None
}
}
Expand Down