mirror of https://github.com/rm-dr/daisy
Compare commits
No commits in common. "599c9742d21b2f4a2503698af08063313a89c0a2" and "c8ebec59ae1d41428055f91d041b8bcd86588e29" have entirely different histories.
599c9742d2
...
c8ebec59ae
|
@ -16,7 +16,6 @@ pub fn is_command(
|
|||
| "vars"
|
||||
| "consts" | "constants"
|
||||
| "del" | "delete"
|
||||
| "flags"
|
||||
=> true,
|
||||
_ => false
|
||||
}
|
||||
|
@ -82,27 +81,6 @@ pub fn do_command(
|
|||
return t;
|
||||
},
|
||||
|
||||
"flags" => {
|
||||
return FormattedText::new(
|
||||
concat!(
|
||||
"\n",
|
||||
"A list of command-line arguments is below\n",
|
||||
"\n",
|
||||
"╞════ [t]Flag[n] ════╪════════════════ [t]Function[n] ════════════════╡\n",
|
||||
" [c]--help[n] Show help\n",
|
||||
" [c]--version[n] Show version\n",
|
||||
" [c]--info[n] Show system information\n",
|
||||
" [c]--256color[n] Use full color support (default)\n",
|
||||
" [c]--8color[n] Use reduced colors (ANSI, no styling)\n",
|
||||
" [c]--nocolor[n] Do not use colors\n",
|
||||
" [c]--nosub[n] Disable inline substitution\n",
|
||||
" [c]--nosuper[n] Disable superscript powers\n",
|
||||
" [c]--nooneover[n] Disable \"one-over\" fractions as -1 power\n",
|
||||
"\n\n"
|
||||
).to_string()
|
||||
);
|
||||
},
|
||||
|
||||
"clear" => {
|
||||
return FormattedText::new("[clear]".to_string());
|
||||
},
|
||||
|
|
37
src/main.rs
37
src/main.rs
|
@ -29,9 +29,7 @@ pub fn main() -> Result<(), std::io::Error> {
|
|||
let mut pb: PromptBuffer = PromptBuffer::new(64);
|
||||
let mut context = Context::new();
|
||||
|
||||
// Detect color compatibilty
|
||||
// Currently unused, this is slow.
|
||||
/*
|
||||
// Set color compatibilty
|
||||
let term_colors = stdout.available_colors().unwrap_or(0);
|
||||
if term_colors >= 256 {
|
||||
context.config.term_color_type = 2;
|
||||
|
@ -40,7 +38,9 @@ pub fn main() -> Result<(), std::io::Error> {
|
|||
} else {
|
||||
context.config.term_color_type = 0;
|
||||
}
|
||||
*/
|
||||
|
||||
context.config.check();
|
||||
|
||||
|
||||
|
||||
// Handle command-line arguments
|
||||
|
@ -48,8 +48,6 @@ pub fn main() -> Result<(), std::io::Error> {
|
|||
if args.iter().any(|s| s == "--help") {
|
||||
let t = command::do_command(&mut context, &String::from("help"));
|
||||
t.write(&context, &mut stdout)?;
|
||||
let t = command::do_command(&mut context, &String::from("flags"));
|
||||
t.write(&context, &mut stdout)?;
|
||||
return Ok(());
|
||||
} else if args.iter().any(|s| s == "--version") {
|
||||
let t = FormattedText::new(format!(
|
||||
|
@ -64,27 +62,12 @@ pub fn main() -> Result<(), std::io::Error> {
|
|||
"Your terminal supports {} colors.\n"
|
||||
),
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
stdout.available_colors().unwrap_or(0)
|
||||
term_colors
|
||||
));
|
||||
t.write(&context, &mut stdout)?;
|
||||
return Ok(());
|
||||
} else if args.iter().any(|s| s == "--256color") {
|
||||
context.config.term_color_type = 2;
|
||||
} else if args.iter().any(|s| s == "--8color") {
|
||||
context.config.term_color_type = 1;
|
||||
} else if args.iter().any(|s| s == "--0color") {
|
||||
context.config.term_color_type = 0;
|
||||
} else if args.iter().any(|s| s == "--nosub") {
|
||||
context.config.enable_substituion = false;
|
||||
} else if args.iter().any(|s| s == "--nosuper") {
|
||||
context.config.enable_super_powers = false;
|
||||
} else if args.iter().any(|s| s == "--nooneover") {
|
||||
context.config.enable_one_over_power = false;
|
||||
}
|
||||
|
||||
context.config.check();
|
||||
|
||||
|
||||
'outer: loop {
|
||||
|
||||
pb.write_prompt(&mut context, &mut stdout)?;
|
||||
|
@ -115,15 +98,7 @@ pub fn main() -> Result<(), std::io::Error> {
|
|||
|
||||
break;
|
||||
},
|
||||
|
||||
// Only process sane characters
|
||||
'a'..='z' | 'A'..='Z' | '0'..='9'
|
||||
|'!'|'@'|'#'|'$'|'%'|'^'|'&'|'*'|'('|')'
|
||||
|'?'|'~'|','|'.'|'['|']'
|
||||
|'<'|'>'|'/'|'_'|'-'|':'|'|'|'='|'+'|';'
|
||||
=> { pb.add_char(*q); },
|
||||
|
||||
_ => {}
|
||||
_ => { pb.add_char(*q); }
|
||||
};
|
||||
} else {
|
||||
match c.unwrap() {
|
||||
|
|
Loading…
Reference in New Issue