cantino / mcfly

Fly through your shell history. Great Scott!
MIT License
6.76k stars 176 forks source link

Can't add history, error #320

Closed r14n closed 1 year ago

r14n commented 1 year ago

My previous bash history did not import, and when I try to add it manually I get an error (I turned on the full rust backtrace to try to help here).

mcfly --debug add ~/.bash_history

thread 'main' panicked at 'McFly error: Insert into commands to work (NOT NULL constraint failed: commands.exit_code)', src/history/history.rs:141:57 stack backtrace: 0: 0x10ac48060 - ::fmt::hdc69a6f447628e71 1: 0x10ab4935a - core::fmt::write::hb9e764fa47ae8444 2: 0x10ac2657c - std::io::Write::write_fmt::h8fc98987ed860a54 3: 0x10ac4b7c3 - std::sys_common::backtrace::print::h488fe4c0b1fb9d50 4: 0x10ac4b58a - std::panicking::default_hook::{{closure}}::h5618ea3156b8b833 5: 0x10ac4bcb3 - std::panicking::rust_panic_with_hook::h57383cd32463c250 6: 0x10ac4b984 - std::panicking::begin_panic_handler::{{closure}}::h1d1f7305cfe67fdd 7: 0x10ac4b8e8 - std::sys_common::backtrace::rust_end_short_backtrace::hd8e12e82ff026bae 8: 0x10ac4b8b2 - _rust_begin_unwind 9: 0x10add95c3 - core::panicking::panic_fmt::h7894cd1015cfee41 10: 0x10ab69833 - mcfly::history::history::History::add::hef9d4411d8d55630 11: 0x10aaf65cc - mcfly::main::hc7215db240a3f685 12: 0x10abbbc36 - std::sys_common::backtrace::rust_begin_short_backtrace::h2b436c5c8d8acd01 13: 0x10aaf74a2 - _main

cantino commented 1 year ago

The add subcommand is used to add a single history item, not perform a file import. It's used by the shell scripts.

What error did you get when trying to import your history? You could delete ~/.mcfly and see if it works a second time.

r14n commented 1 year ago

Understood.

I see, I also should mention I'm using a Mac, so I've now learned that when you talk about ~/.mcfly it's the equivalent of ~/Library/Application Support/McFly. I deleted that dir and now it looks like all my commands imported.

FWIW the message is the same as the first time (when it didn't work right): "McFly: Importing shell history for the first time. This may take a minute or two...done."

Thanks! Cool program!

cantino commented 1 year ago

Glad it worked a second time!