Skip to content

Instantly share code, notes, and snippets.

@wycats
Created May 28, 2014 00:39
Show Gist options
  • Save wycats/448929151c664dffde5d to your computer and use it in GitHub Desktop.
Save wycats/448929151c664dffde5d to your computer and use it in GitHub Desktop.
extern crate term;
use term::Terminal;
struct ShellConfig {
color: int,
verbose: int,
tty: bool,
}
enum AdequateTerminal<T> {
Color(Box<Terminal<T>>)
}
struct Shell<T> {
terminal: AdequateTerminal<T>,
config: ShellConfig,
}
impl <T: Writer + Send> Shell<T> {
fn create(out: T, config: ShellConfig) -> Option<Shell<T>> {
let term: Option<term::TerminfoTerminal<T>> = Terminal::new(out);
term.map(|t: term::TerminfoTerminal<T>| Shell { terminal: Color(box t), config: config })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment