summaryrefslogtreecommitdiffstats
path: root/src/commands/command_line.rs
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2020-02-13 08:12:05 -0500
committerJiayi Zhao <jeff.no.zhao@gmail.com>2020-02-13 08:16:27 -0500
commit89b08eb9905db22a3e9751f44440d22e114277a3 (patch)
treeb5b858192aabf020aea039061d607e171cc3fb7b /src/commands/command_line.rs
parent6042557a5e88601cb37b6067a5fdb547f6aca232 (diff)
textfield progression
Diffstat (limited to 'src/commands/command_line.rs')
-rw-r--r--src/commands/command_line.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/commands/command_line.rs b/src/commands/command_line.rs
index 5f5b9db..4d3c820 100644
--- a/src/commands/command_line.rs
+++ b/src/commands/command_line.rs
@@ -2,7 +2,6 @@ use crate::commands::{self, JoshutoCommand, JoshutoRunnable};
use crate::context::JoshutoContext;
use crate::error::JoshutoResult;
use crate::textfield::TextField;
-use crate::ui;
use crate::ui::TuiBackend;
#[derive(Clone, Debug)]
@@ -24,18 +23,18 @@ impl CommandLine {
context: &mut JoshutoContext,
backend: &mut TuiBackend,
) -> JoshutoResult<()> {
- // let mut textfield =
- let mut textfield = TextField::new(backend, &context.events);
- let user_input: Option<String> = None; //textfield.readline();
+ let mut textfield = TextField::new(backend, &context.events);
+ let user_input: Option<String> = textfield.readline();
if let Some(s) = user_input {
let trimmed = s.trim_start();
match trimmed.find(' ') {
Some(ind) => {
- let (command, xs) = trimmed.split_at(ind);
+ let (cmd, xs) = trimmed.split_at(ind);
let xs = xs.trim_start();
let args: Vec<String> = vec![String::from(xs)];
- commands::from_args(String::from(command), args)?.execute(context, backend)
+ let command = commands::from_args(cmd.to_string(), args)?;
+ command.execute(context, backend)
}
None => commands::from_args(String::from(trimmed), Vec::new())?
.execute(context, backend),