summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2023-04-11 20:45:11 +0200
committerJustin Wernick <justin@worthe-it.co.za>2023-04-11 20:45:11 +0200
commite6ed91d0efab436c8a1ca4b6f701b6a9a4d96ccd (patch)
treed246e448c6cbd86df795452c220f39723d09a714 /src/main.rs
parent972319c1811e1a9c4f491a03ba92ea5a624cca5e (diff)
Refactoring, move where whitespace is handled
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index acb6df2..99b755d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -22,7 +22,7 @@ fn main_inner() -> Result<(), ShackleError> {
let args = Args::parse();
match args.command {
Some(user_input) => {
- run_command(user_input)?;
+ run_command(&user_input)?;
}
None => {
run_interactive_loop()?;
@@ -36,9 +36,10 @@ fn run_interactive_loop() -> Result<(), ShackleError> {
let mut rl = DefaultEditor::new()?;
loop {
let readline = rl.readline("> ");
- match readline {
+ match readline.as_ref().map(|user_input| user_input.trim()) {
+ Ok("") => {}
Ok(user_input) => {
- rl.add_history_entry(user_input.as_str())?;
+ rl.add_history_entry(user_input)?;
match run_command(user_input) {
Ok(control_flow) => {
if control_flow.is_break() {