Use # instead of ? to debug app

pull/3/head
Arijit Basu 3 years ago
parent d5bfe6630f
commit 53b18ae8f4
No known key found for this signature in database
GPG Key ID: 7D7BF809E7378863

@ -41,7 +41,7 @@ cargo install xplr
```bash
mkdir -p ~/.config/xplr
echo "?" | xplr | yq ".config" -y | tee ~/.config/xplr/config.yml
echo "#" | xplr | yq ".config" -y | tee ~/.config/xplr/config.yml
```
3. Check the key bindings in the config file.

@ -227,7 +227,7 @@ impl Default for KeyBindings {
help: quit
actions:
- Quit
question-mark:
pound:
help: print debug info
actions:
- PrintAppState

@ -242,6 +242,7 @@ pub enum Key {
Dot,
Comma,
QuestionMark,
Pound,
NotSupported,
}
@ -482,6 +483,7 @@ impl Key {
TermionKey::Char('.') => Key::Dot,
TermionKey::Char(',') => Key::Comma,
TermionKey::Char('?') => Key::QuestionMark,
TermionKey::Char('#') => Key::Pound,
_ => Key::NotSupported,
}

@ -1,6 +1,7 @@
use crossterm::terminal as term;
use handlebars::{handlebars_helper, Handlebars};
use shellwords;
use std::fs;
use std::io;
use termion::get_tty;
use termion::{input::TermRead, screen::AlternateScreen};
@ -12,10 +13,9 @@ use xplr::app::Task;
use xplr::error::Error;
use xplr::input::Key;
use xplr::ui;
use std::fs;
handlebars_helper!(shellescape: |v: str| format!("{}", shellwords::escape(v)));
handlebars_helper!(readfile: |v: str| fs::read_to_string(v).unwrap());
handlebars_helper!(readfile: |v: str| fs::read_to_string(v).unwrap_or_default());
fn main() -> Result<(), Error> {
let mut app = app::create()?;
@ -111,6 +111,8 @@ fn main() -> Result<(), Error> {
a
}
Err(e) => {
term::disable_raw_mode().unwrap();
std::mem::drop(terminal);
result = Err(e);
break 'outer;
}

Loading…
Cancel
Save