Repository: cantino/mcfly (language: rust)

Issue:
Insufficient documentation / how to run it?
Hello,

I've downloaded the latest release archive and there are the binary file and shell files.
I created `~/.bin` directory and placed the files there and added `~/.bin` to the PATH.

I'm on Ubuntu 20.04.2 and use Guake + Zsh + OhMyZSH (with plugins) + powerlevel10k theme.
What are my next steps? I placed at the end of .zshrc:

```
export PATH="$PATH:$HOME/.bin"
export MCFLY_FUZZY=true
export MCFLY_RESULTS=50

# tried with it and without it
# ~/.bin/mcfly.zsh

eval "$(mcfly init zsh)"
```

Once I got setup-dialog from McFly and it even created `~/.mcfly/history.db`, but then it's not bonded with Ctrl+R. I tried to disabled `fzf` and `history` plugins from OhMyZSH, and after that, I've got just plain ctrl+R function.

How to make it work and how to use mcfly.zsh / mcfly.bash scripts?


Discussion / hints:
Ok so `mcfly init zsh` just returns the same content as in these scripts...

I tried to run 
```
eval "$(mcfly init zsh)"
```
in opened shell and it worked. But for some reason, it's not working when I placed that at the end of the .zshrc file.
Are you sure that last line of your `.zshrc` file is getting executed? Maybe add an `echo` statement or check that `MCFLY_HISTORY` is set in `env`?
I did a little debugging and seems my ZSH installation reacts to this instruction:
```
[[ -t 0 ]] || return
```
when I changed it to:
```
if [ -t 1 ]; then return 0; fi
```
it started working as expected...
Does `if [[ ! -t 0 ]]; then return 0; fi` work?
Nope, that is not working...

Good examples of how to check if a shell is interactive or not in various shells: 
https://unix.stackexchange.com/questions/26676/how-to-check-if-a-shell-is-login-interactive-batch/26782
```
[[ ! -o interactive ]] && return 0
```
this works for me

Fix patch:
diff --git a/mcfly.zsh b/mcfly.zsh
index 9fda135d..9a7cab32 100644
--- a/mcfly.zsh
+++ b/mcfly.zsh
@@ -1,7 +1,7 @@
 #!/bin/zsh
 
 # Ensure stdin is a tty
-[[ -t 0 ]] || return
+[[ ! -o interactive ]] && return 0
 
 # Avoid loading this file more than once
 if [[ "$__MCFLY_LOADED" == "loaded" ]]; then


Test patch: