aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNerdyPepper <[email protected]>2019-06-18 07:52:07 +0100
committerNerdyPepper <[email protected]>2019-06-18 07:52:07 +0100
commit1a06f12da5e701b778009fc5c81db28f092fcede (patch)
tree41aa18e98550c263e04a17d085a40b7bb7d8a561 /src
parent2eda7d259dc7529ddaf52c30558d1e0432217959 (diff)
add history hinting
Diffstat (limited to 'src')
-rw-r--r--src/main.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 5846a87..ffdb690 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -20,10 +20,14 @@ use crate::format::*;
20// extern crates 20// extern crates
21use rustyline::error::ReadlineError; 21use rustyline::error::ReadlineError;
22use rustyline::Editor; 22use rustyline::Editor;
23use rustyline::config::{ Builder, ColorMode, EditMode }; 23use rustyline::config::{ Builder, ColorMode, EditMode, CompletionType };
24use rustyline::highlight::{ Highlighter, MatchingBracketHighlighter };
25use rustyline::hint::{ Hinter, HistoryHinter };
24use clap::{Arg, App}; 26use clap::{Arg, App};
25use lazy_static::lazy_static; 27use lazy_static::lazy_static;
26 28
29struct LineHelper (MatchingBracketHighlighter, HistoryHinter);
30
27struct Configuration { 31struct Configuration {
28 radian_mode: bool, 32 radian_mode: bool,
29 fix: usize, 33 fix: usize,
@@ -50,6 +54,7 @@ fn main() {
50 let config = config_builder.color_mode(ColorMode::Enabled) 54 let config = config_builder.color_mode(ColorMode::Enabled)
51 .edit_mode(EditMode::Emacs) 55 .edit_mode(EditMode::Emacs)
52 .history_ignore_space(true) 56 .history_ignore_space(true)
57 .completion_type(CompletionType::Circular)
53 .max_history_size(1000) 58 .max_history_size(1000)
54 .build(); 59 .build();
55 let mut rl = Editor::<()>::with_config(config); 60 let mut rl = Editor::<()>::with_config(config);
@@ -102,7 +107,7 @@ fn parse_arguments() -> Configuration {
102 .long("base") 107 .long("base")
103 .takes_value(true) 108 .takes_value(true)
104 .value_name("RADIX") 109 .value_name("RADIX")
105 .help("set the radix of calculation output (2, 8, 10, 16 etc.)")) 110 .help("set the radix of calculation output (1 - 36)"))
106 .arg(Arg::with_name("INPUT") 111 .arg(Arg::with_name("INPUT")
107 .help("optional expression string to run eva in command mode") 112 .help("optional expression string to run eva in command mode")
108 .index(1)) 113 .index(1))