Skip to content

Instantly share code, notes, and snippets.

@PetrGlad
Created December 21, 2016 22:59
Show Gist options
  • Save PetrGlad/39dc2482e77f48ab1845147670c31bf7 to your computer and use it in GitHub Desktop.
Save PetrGlad/39dc2482e77f48ab1845147670c31bf7 to your computer and use it in GitHub Desktop.
Rust prompt
[package]
name = "my-prompt"
version = "0.1.0"
authors = ["Petr Gladkikh <[email protected]>"]
[dependencies]
nix = "0.7.0"
extern crate nix;
use nix::unistd::*;
fn main() {
if geteuid() == 0 {
println!("\x1b[01;31m⚠\x1b[00m"); // ☠
} else {
println!("\x1b[01;32m☯\x1b[00m");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment