diff options
author | NerdyPepper <[email protected]> | 2019-06-18 07:52:07 +0100 |
---|---|---|
committer | NerdyPepper <[email protected]> | 2019-06-18 07:52:07 +0100 |
commit | 1a06f12da5e701b778009fc5c81db28f092fcede (patch) | |
tree | 41aa18e98550c263e04a17d085a40b7bb7d8a561 /src/main.rs | |
parent | 2eda7d259dc7529ddaf52c30558d1e0432217959 (diff) |
add history hinting
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 9 |
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 |
21 | use rustyline::error::ReadlineError; | 21 | use rustyline::error::ReadlineError; |
22 | use rustyline::Editor; | 22 | use rustyline::Editor; |
23 | use rustyline::config::{ Builder, ColorMode, EditMode }; | 23 | use rustyline::config::{ Builder, ColorMode, EditMode, CompletionType }; |
24 | use rustyline::highlight::{ Highlighter, MatchingBracketHighlighter }; | ||
25 | use rustyline::hint::{ Hinter, HistoryHinter }; | ||
24 | use clap::{Arg, App}; | 26 | use clap::{Arg, App}; |
25 | use lazy_static::lazy_static; | 27 | use lazy_static::lazy_static; |
26 | 28 | ||
29 | struct LineHelper (MatchingBracketHighlighter, HistoryHinter); | ||
30 | |||
27 | struct Configuration { | 31 | struct 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)) |