Address review comments
This commit is contained in:
parent
bad508de02
commit
171209d060
3 changed files with 5 additions and 12 deletions
|
@ -8,7 +8,7 @@
|
|||
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations under the License.
|
||||
|
||||
use std::io::{self, stdin, BufRead, BufReader};
|
||||
use std::io::{stdin, BufReader};
|
||||
|
||||
use linefeed::Reader;
|
||||
use linefeed::terminal::DefaultTerminal;
|
||||
|
@ -18,7 +18,7 @@ use self::InputResult::*;
|
|||
/// Possible results from reading input from `InputReader`
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum InputResult {
|
||||
/// rusti command as input; (name, rest of line)
|
||||
/// mentat command as input; (name, rest of line)
|
||||
Command(String, Option<String>),
|
||||
/// An empty line
|
||||
Empty,
|
||||
|
@ -88,7 +88,7 @@ impl InputReader {
|
|||
Some(ref mut r) => {
|
||||
r.set_prompt(prompt);
|
||||
r.read_line().ok().and_then(|line| line)
|
||||
}
|
||||
},
|
||||
None => self.read_stdin()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations under the License.
|
||||
|
||||
#![crate_name = "mentat_cli"]
|
||||
|
||||
#[macro_use] extern crate log;
|
||||
|
|
|
@ -13,9 +13,8 @@ use input::InputResult::{Command, Empty, More, Eof};
|
|||
/// Starting prompt
|
||||
const DEFAULT_PROMPT: &'static str = "mentat=> ";
|
||||
/// Prompt when further input is being read
|
||||
// TODO: Should this actually reflect the current open brace?
|
||||
const MORE_PROMPT: &'static str = "mentat.> ";
|
||||
/// Prompt when a `.block` command is in effect
|
||||
const BLOCK_PROMPT: &'static str = "mentat+> ";
|
||||
|
||||
/// Executes input and maintains state of persistent items.
|
||||
pub struct Repl {
|
||||
|
@ -27,7 +26,6 @@ impl Repl {
|
|||
Repl{}
|
||||
}
|
||||
|
||||
|
||||
/// Runs the REPL interactively.
|
||||
pub fn run(&mut self) {
|
||||
let mut more = false;
|
||||
|
@ -35,12 +33,6 @@ impl Repl {
|
|||
|
||||
loop {
|
||||
let res = input.read_input(if more { MORE_PROMPT } else { DEFAULT_PROMPT });
|
||||
// let res = if self.read_block {
|
||||
// self.read_block = false;
|
||||
// input.read_block_input(BLOCK_PROMPT)
|
||||
// } else {
|
||||
// input.read_input(if more { MORE_PROMPT } else { DEFAULT_PROMPT })
|
||||
// };
|
||||
|
||||
match res {
|
||||
Command(name, args) => {
|
||||
|
|
Loading…
Reference in a new issue