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 ```bash
mkdir -p ~/.config/xplr 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. 3. Check the key bindings in the config file.

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

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

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

Loading…
Cancel
Save