Closed manfredlotz closed 1 year ago
Hey @manfredlotz, sorry you're having issues with mcfly. I honestly don't know why you're getting that error if MCFLY_HISTORY is set. I don't use fish myself. My config.fish for testing just includes
mcfly init fish | source
mcfly_key_bindings
The problem is that MCFLY_HISTORY
is not set as I showed above. Simply, because mcfly init fish | source
doesn't set it.
I find the line
# We don't need a MCFLY_HISTORY file because we can get the last command in fish_postexec.
in the output of mcfly init fish
.
So, the conclusion is that something is inconsistent here.
Okay, so what's weird here is that it first tries to call cli.mcfly_history, which should have been set by
set -g __MCFLY_CMD $MCFLY_PATH --mcfly_history /dev/null --history_format fish
It's being set to /dev/null
but it is providing that as a command line argument, so the code in src/settings.rs:177:25 should never have run.
What happens if you set MCFLY_DEBUG to true in a new shell? Here's what I see:
andrew@Andrews-Mac ~/p/r/mcfly (master)> fish --version
fish, version 3.6.1
mcfly.fish: Run eval target/debug/mcfly --mcfly_history /dev/null --history_format fish add --exit $last_status --old-dir $__MCFLY_OLD_PWD -- $argv[1]
andrew@Andrews-Mac ~/p/r/mcfly (master)>
❯ set MCFLY_DEBUG true
yields
mcfly.fish: Run eval /usr/bin/mcfly --mcfly_history /dev/null --history_format fish add --exit $last_status --old-dir $__MCFLY_OLD_PWD -- $argv[1]
Ok, here I didn't have a problem anyway.
Even with setting MCFLY_DEBUG
to true the search
❯ mcfly search bla
yields
thread 'main' panicked at 'McFly error: Please ensure that MCFLY_HISTORY is set (environment variable not found)', src/settings.rs:177:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
mcfly.fish: Run eval /usr/bin/mcfly --mcfly_history /dev/null --history_format fish add --exit $last_status --old-dir $__MCFLY_OLD_PWD -- $argv[1]
Of course, if I do this mcfly --mcfly_history /dev/null search bla
then there is no problem
Oh! mcfly search
isn't really intended to be executed directly. The intended use is for mcfly to be executed via Ctrl-R in the shell.
ok, understand.
Trying out mcfly in fish shell and get a panic.
mcfly 0.8.0 fish, version 3.6.0
I have
at the end of
~/.config/fish/config.fish
env | grep MCFLY
givesNow running
mcfly search something
I get