Giter Site home page Giter Site logo

mcfly's People

Contributors

agrism avatar akinnane avatar b3nj5m1n avatar bnprks avatar cantino avatar dmfay avatar domoritz avatar f355 avatar federicotdn avatar freamon avatar goddade avatar jamjar00 avatar jirutka avatar jtschuster avatar kothavade avatar lukaspietzschmann avatar markusjevringgoeuro avatar marshall avatar melkor333 avatar namorzyny avatar navazjm avatar nfultz avatar otherjl0 avatar praveenperera avatar rawkode avatar rbutoi avatar safarimonkey avatar td-sky avatar vmax avatar zampierilucas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mcfly's Issues

Highlight search string in a case-insensitive way

Right now search is done in a case-insensitive way, but in found commands matched fragments are highlighted in respect for case. In this situation it becomes hard to spot in a command why it was found at all.

I'm proposing to use approach from PhpStorm IDE: highlight what's being searched for. As for implementation:

  1. lowercase found data to get string offset to highlight
  2. apply highlighting based on above found offset, but use original (non-lowercased) found data

Example when command is found, but not highlighted:
2019-02-11_1722

Example when command is found and is highlighted:
2019-02-11_1722-1

change other bash history env?

This has been in my .bashrc for many years:

export HISTSIZE=100000
export HISTTIMEFORMAT=': %Y-%m-%d_%H:%M:%S; '
export HISTIGNORE="&:ls:ll:[bf]g:w:who:exit:history"
export HISTCONTROL="ignoreboth"

I'm looking at swapping in mcfly. Do I need to modify these in any way? Does mcfly's database honor HISTSIZE or does it store/remember forever?

error if running multiple commands from different shells

I'm working with multiple bash shells and ran in the following error while I ran 3 commands in different shells:
thread 'main' panicked at 'McFly error: Unable to create schema_versions db table: SqliteFailure(Error { code: DatabaseBusy, extended_code: 5 }, Some("database is locked"))', src/libcore/result.rs:1009:5
note: Run with RUST_BACKTRACE=1 for a backtrace.

I'm using McFly version 0.3.3.

Panic when .bash_history is missing

Hi,

I started to get those messages whenever I open a new terminal:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', libcore/result.rs:1009:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

I can confirm they are coming from McFly because they disappear as soon as I remove the integration in my profile. Ie if I comment out this:

if [[ -f "$(brew --prefix)/opt/mcfly/mcfly.bash" ]]; then
  source "$(brew --prefix)/opt/mcfly/mcfly.bash"
fi

Sadly, the backtrace is not helpful:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', libcore/result.rs:1009:5
stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>

I'm not 100% sure why/when it started. I'm guessing something changed on my machine but I'm not quite sure what. I upgraded to Mojave a couple weeks back but this only started a couple days ago. Aside from the message, everything else still works fine: I can use McFly and it records my commands properly.

Ideas?

Thanks!

Consider to add loading progress to first time run message

McFly: Importing Bash history for the first time. This may take a minute or two...

This is misleading. My .bash_history is about 5MB big and I keep seeing this message for at least 15 minutes on a quad core CPU. Another ugly side effect that no terminal windows can be spawned meanwhile - they stay locked (the workaround is simple, use a shell in a terminal that was already started before enabling mcfly, but this can be a problem if there's none). Perhaps you need to add some import progress like "x out of y lines from .bash_history are imported"?

Crashes when non-unicode characters are present in `.bash_history`

I happened to have created a directory a while back that is invalid in any encoding scheme available in python, for testing. The mkdir and cd are then in my bash history file, and contain invalid unicode. I was able to reduce the reproducing example down to:

$ cat ~/.bash_history
cd �abc\\uXXXX/
$ xxd ~/.bash_history
00000000: 6364 2080 6162 635c 5c75 5858 5858 2f0a  cd .abc\\uXXXX/.

which causes the following crash:

thread 'main' panicked at '"/tmp/mcfly.HE5x" file not found: Custom { kind: InvalidData, error: StringError("stream did not contain valid UTF-8") }', libcore/result.rs:1009:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
             at libstd/panicking.rs:211
   2: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:227
             at libstd/panicking.rs:476
   3: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:390
   4: rust_begin_unwind
             at libstd/panicking.rs:325
   5: core::panicking::panic_fmt
             at libcore/panicking.rs:77
   6: core::result::unwrap_failed
   7: mcfly::bash_history::full_history
   8: mcfly::bash_history::last_history_line
   9: mcfly::settings::Settings::parse_args
  10: mcfly::main
  11: std::rt::lang_start::{{closure}}
  12: main
  13: __libc_start_main
  14: _start

I tried the following diff, and ran into further errors:

# git diff
diff --git a/src/bash_history.rs b/src/bash_history.rs
index dcbc34c..014deec 100644
--- a/src/bash_history.rs
+++ b/src/bash_history.rs
@@ -12,12 +12,12 @@ pub fn bash_history_file_path() -> PathBuf {
 }
 
 pub fn full_history(path: &PathBuf) -> Vec<String> {
-    let bash_history_contents =
-        fs::read_to_string(&path).expect(format!("{:?} file not found", &path).as_str());
+    let bash_history_contents = fs::read_to_string(&path).unwrap_or_default();
 
     let timestamp_regex = Regex::new(r"\A#\d{10}").unwrap();
 
     bash_history_contents
+        .as_str()
         .split("\n")
         .filter(|line| !timestamp_regex.is_match(line) && !line.is_empty())
         .map(String::from)

After the above diff:

thread 'main' panicked at '"/tmp/mcfly.s88g" file not found: Custom { kind: InvalidData, error: StringError("stream did not contain valid UTF-8") }', libcore/result.rs:1009:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
             at libstd/panicking.rs:211
   2: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:227
             at libstd/panicking.rs:476
   3: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:390
   4: rust_begin_unwind
             at libstd/panicking.rs:325
   5: core::panicking::panic_fmt
             at libcore/panicking.rs:77
   6: core::result::unwrap_failed
   7: mcfly::settings::Settings::parse_args
   8: mcfly::main
   9: std::rt::lang_start::{{closure}}
  10: main
  11: __libc_start_main
  12: _start

McFly makes noise when user moves a folder.

This just happened, and seems undesirable. I moved a folder and McFly prints a pointless message.

gwk ~/work/pdfminer3/test master*%> $ mv crypto/ decrypt
McFly: Command database paths renamed from /Users/gwk/work/pdfminer3/test/crypto to /Users/gwk/work/pdfminer3/test/decrypt (affected 0 commands)

Consider to add README to binary release tarballs?

Once you learn it, it's simple: have mcfly in PATH and source the provided shell script. But a total beginner still may need to go back to the github repo to read the README after downloading the binary release. I suppose binary releases are often a choice for first time end users, since rust is still quite new and exotic / not available everywhere by default / not trivial to use to compile from source by someone who knows nothing about it. Having the README in the binary release tarball would make it self-sufficient.

Doesn't work with WSL

Similarly to #22 I can open up the display, and choose my command, but in the end, all it tried to execute is mcfly search, no matter what I type or select.

[~]
$ #mcfly:
[~]
$  mcfly search
[~]
$
$ cat /etc/issue.net
Ubuntu 18.04.1 LTS

Question: Is Midnight Commander supported?

In Midnight Commander:

  • current directory logically changes when you switch from one panel into another and back, but I'm not sure if Bash is able to detect that
  • PROMPT_COMMAND (that is changed by McFly) is also invoked

Have you checked that commands executed from Midnight Commander command line are tracked against proper directory?

Fish support

This looks awesome, and admittedly this is more of a question than an issue per se. 😄

Any plans to add support for Fish shell?

Scroll search results according to window height

When Terminal window can't fit all 10 results, then attempt to navigate into 6+ result just moves selection cursor out of the screen.

I'm proposing to implement clever scrolling, where search results are scrolled to fit inside visible Terminal window area.

CASE1 (works currently): when 10 results fits initially (14 lines occupied):

McFly | ESC - Exit | ⏎ - Run | TAB - Edit | F2 - Delete                                                                           

$ 

result1 <--- cursor here
result2
result3
result4
result5
result6
result7
result8
result9
result10

CASE2 (works currently): When 6 results fits initially (10 lines occupied):

McFly | ESC - Exit | ⏎ - Run | TAB - Edit | F2 - Delete                                                                           

$ 

result1 <--- cursor here
result2
result3
result4
result5
result6

CASE3 (proposed): When 6 results fits and I've scrolled to 7th result (10 lines occupied):

McFly | ESC - Exit | ⏎ - Run | TAB - Edit | F2 - Delete                                                                           

$ 

result2
result3
result4
result5
result6
result7 <--- cursor here

Real use case: Terminal opened inside PhpStorm.

Sqlite3 error: duplicate column name: cmd_tpl

@Lomanic wrote:

I'm trying McFly 0.3.3 (binary release x64 and manual install) on Debian 9 and I'm encountering the same error

McFly: Upgrading McFly DB to version 3, please wait...thread 'main' panicked at 'McFly error: Unable to add cmd_tpl to commands: SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some("duplicate column name: cmd_tpl"))', src/libcore/result.rs:1009:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Setting export RUST_BACKTRACE=1 adds the following backtrace

stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: main
  10: __libc_start_main
  11: <unknown>

For me mcfly.bash is properly sourced (MCFLY_SESSION_ID and MCFLY_HISTORY are set)

Here is the result of export RUST_BACKTRACE=1 && rm ~/.mcfly/history.db

McFly: Importing Bash history for the first time. This may take a minute or two...thread 'main' panicked at 'McFly error: Insert to work: NulError(NulError(0, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 49, 53, 51, 56, 56, 49, 51, 53, 49, 54]))', src/libcore/result.rs:1009:5
stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: main
  10: __libc_start_main
  11: <unknown>

Unable to find all recent commands.

Unable to find all recent commands.

Some recently ran commands do not show up in mcfly at all.
Also the list of suggested commands is quite short.

In my case it would also be useful to retrieve a command that was executed in a different working directory.

Do not overwrite HISTFILE

I am using a custom HISTFILE name. And to keep it that way, I also make this variable readonly.

As mcfly does
export HISTFILE="${HISTFILE:-$HOME/.bash_history}"

this leads to an annoying warning:
bash: HISTFILE: readonly variable
A check like

if [ -z "${HISTFILE}" ]; then
    export HISTFILE="${HOME}/.bash_history"
fi

would prevent this warning for me.

how to get the most recent match ?

Hi, Thanks for this nice software.

Quite often, I want to recall a command I typed a few minutes ago (e.g. "git commit ..."), but mcfly proposes some much more older matching commands.
I understand that it is due to its algorithm, but I'd like to force it to output the matches ordered by "recentness".
Is that possible ?
Otherwise would it be possible to add a shortcut that will reorder the matches by recentness ?

Karl

Automatic Bash completion inclusion with Homebrew

Homebrew is able to automatically enable completion for installed packages without need to add below code to ~/.bashrc file:

if [[ -r "$(brew --prefix)/opt/mcfly/mcfly.bash" ]]; then
  source "$(brew --prefix)/opt/mcfly/mcfly.bash"
fi

when you have this code in there already (you should have it since it's part of Homebrew installation process):

if [ -f $(brew --prefix)/etc/bash_completion ]; then
  . $(brew --prefix)/etc/bash_completion
fi

Theoretically (I'm not creating Homebrew packages usually) adding below line to installation part of Homebrew Formula should do the trick:

bash_completion.install "mcfly.bash"

Maybe above line should replace prefix.install "mcfly.bash" line.

Add Ctrl-j/k movement bindings

I would like to be able to use Ctrl-j and Ctrl-k to move up and down, similar to the movement keys in FZF. Would this be possible?

Search is prefilled with `mcfly search`

Immediately after installation mcfly seemed to work as expected. Upon a reboot, however, pressing ctrl+r gets me a mcfly session already prefilled with mcfly search - if I type a space and then a search term, and press enter, I find myself in another mcfly session with my search results. (If I omit the space I get a complaint from mcfly about 'the subcommand 'search<term>' wasn't recognized', which seems reasonable).

I have a custom PROMPT_COMMAND but nothing else noteworthy springs to mind.

Any ideas what might be interfering? I think I initially installed 0.2.3 (cleverly I deleted the tarfile after extracting it) and have upgraded to 0.2.4 with no change in behaviour.

README improvement

Hi,
Please add "Usage" section to the readme file. And especially information about using '%' symbol as a way to use multiple searching patterns.
Thanks in advance

crates.io upload

Would it be possible to put mcfly on crates.io so that installation works with "cargo install"?
As a Linux user i don't even know what "brew" is ;)

Add GLIBC 2.16 compatible binary when releasing

I've downloaded mcfly-v0.3.1-x86_64-unknown-linux-gnu.tar.gz binary from a latest release and when running mcfly command I've got this error:

./mcfly: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./mcfly)

Doing ls -la /lib64/libc.so.6 command showed, that I have GLIBC_2.13:

lrwxrwxrwx 1 root root 12 Sep 21  2012 /lib64/libc.so.6 -> libc-2.13.so*

Would it be possible to also provide (in each release) Linux binary compiled against GLIBC 2.16?

P.S.
I was able to get McFly running by following manual compilation instructions, but was of course was a bit longer, then just using pre-compiled binary.

Put a comparisons section in the README

The tool looks great, and for users who don't use a history replacement tool already it looks like a no-brainer.

For those of us who already use one— how does mcfly compare to fzf, hstr, peco etc? What features would really make us want to jump ship?

Unable to get desired command suggested

As far as I understand:

  1. the McFly is only able to suggest commands that were previously executed
  2. new commands are executed outside of McFly and therefore are never added to it's database as being executed from a particular folder (because current folder isn't logged in analyzed .bash_history file)
  3. since suggestions are given for current folder only, then new commands are never suggested
  4. only commands initially found in .bash_history file are suggested

At least it happens like this for me. Any idea why I'm experiencing such behavior?

cat /dev/urandom never closes

I'm trying to build a package for Nixos, but when I source the macfly.bash file, it hangs on the following line:

export MCFLY_SESSION_ID=$(cat /dev/urandom | env LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1)

It's maybe due to the problem described in this forum. Cat is never stopped...

What seems to stop the command is using head -c 24 instead of the fold ... | head -n 1:

[sam@Waluigi:~/projects/mcfly]$ x=$(cat /dev/urandom | env LC_ALL=C tr -dc 'a-zA-Z0-9' | head -c 24)
tr: write error: Broken pipe
tr: write error
cat: write error: Broken pipe
[sam@Waluigi:~/projects/mcfly]$ echo $x
ktgQD1V2qVWbvuLUnFTEhwGg

But then the broken pipe errors appear as you can see. I think they could be discarded with

x=$(cat /dev/urandom 2>/dev/null| env LC_ALL=C tr -dc 'a-zA-Z0-9' 2>/dev/null | head -c 24)

Bash crashes

Hi,

Everything was working and suddenly i got:

Warning: Program '/bin/bash' crashed.

I tried reinstalling a new version v0.2.4 (downloading zip etc). But to no avail. I have also removed the history.db and which also did not help.

My history settings:

export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
export HISTFILE=~/.bash_eternal_history
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"

When removing source "/home/me/opt/mcfly/mcfly.bash" line from my .bashrc bash works again.

Below is an error that is generated in journald when starting bash with myfly:

Dec 09 10:34:59 hprp audit[14797]: ANOM_ABEND auid=1000 uid=1000 gid=1000 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=14797 comm="bash" exe="/usr/bin/bash" sig=11 res=1
Dec 09 10:34:59 hprp systemd[1]: Started Process Core Dump (PID 15455/UID 0).
Dec 09 10:34:59 hprp audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-coredump@39-15455-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Dec 09 10:34:59 hprp systemd-coredump[15456]: Process 14797 (bash) of user 1000 dumped core.
                                              
                                              Stack trace of thread 14797:
                                              #0  0x000055c474b2161f _hs_append_history_line (bash)
                                              #1  0x000055c474b24e13 read_history_range (bash)
                                              #2  0x000055c474ae86bc history_builtin (bash)
                                              #3  0x000055c474a97275 n/a (bash)
                                              #4  0x000055c474a99e12 n/a (bash)
                                              #5  0x000055c474a9b0d4 execute_command_internal (bash)
                                              #6  0x000055c474a9bc63 execute_command_internal (bash)
                                              #7  0x000055c474a9c9b6 execute_command (bash)
                                              #8  0x000055c474a9bc30 execute_command_internal (bash)
                                              #9  0x000055c474a9c9b6 execute_command (bash)
                                              #10 0x000055c474a9bc30 execute_command_internal (bash)
                                              #11 0x000055c474ae4cf4 parse_and_execute (bash)
                                              #12 0x000055c474a9068a execute_variable_command (bash)
                                              #13 0x000055c474a84109 parse_command (bash)
                                              #14 0x000055c474a841d8 read_command (bash)
                                              #15 0x000055c474a84460 reader_loop (bash)
                                              #16 0x000055c474a82b69 main (bash)
                                              #17 0x00007f2516aff413 __libc_start_main (libc.so.6)
                                              #18 0x000055c474a8330e _start (bash)
Dec 09 10:34:59 hprp audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-coredump@39-15455-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? te

Thanks

Zsh

Awesome!! Any plan on making it available for zsh?

Question: Reason for initial completion not being empty?

When I press Ctrl+R for the first time the last command is shown automatically. This is radically different comparing to approach default Ctrl+R does, where no command is shown and I have to start typing.

Currently I have to delete suggested command first (one-by-one symbol) and start typing what I actually wanted to see.

Maybe instead it's possible to show list of suggested commands below and by pressing Down arrow people then can manually confirm, that they want 1st suggested entry to be used.

Right now I don't have a choice really.

Internal output not removed after closing

I have setup 2 line bash prompt, that looks like this (not sure if that causes issue to happen):

2019-02-09_0945

I then enable McFly by pressing Ctrl+R and immediately exit via Esc. After that I'm seeing that 2 commands were executed and are displayed on screen:

  • #mcfly:
  • mcfly search

2019-02-09_0946

Is there any reason for not to removing these commands (e.g. I'm not seeing any extra commands, when using native Ctrl+R search)?

Related #44

Multiline commands are sometimes split in bash history.

Multiline commands are sometimes split in bash history.

Pasting this in the terminal and then pasting the following:

some_function () {
  printf '1\t2\t3\n' \
    | awk -F '\t' '
    {
        print $1;
        print $2;
        print $3;
    }' \
    | cat 
}

In bash without mcfly, pressing the up key, will bring back this full entry (history command):

 2006  some_function () {   printf '1\t2\t3\n'     | awk -F '\t' '
    {
        print $1;
        print $2;
        print $3;
    }'     | cat ; }

With mcfly, this entry is splitted:

 1340  some_function () {   printf '1\t2\t3\n'     | awk -F '\t' '
 1341      {
 1342          print $1;
 1343          print $2;
 1344          print $3;
 1345      }'     | cat ; }

Stray messages are shown in the bash scrollback

If I run a command in bash:

$ echo goodbye world
goodbye world

I then press Ctrl-r goodbye Ctrl-c, and I see this in my bash session:

$ echo goodbye world
goodbye world
$ #mcfly: 
$  mcfly search
$ 

SqliteFailure

• • • source mcfly.bash
• • •
McFly: Upgrading McFly DB to version 3, please wait...thread 'main' panicked at 'McFly error: Unable to add cmd_tp
l to commands: SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some("duplicate column name: cmd_tpl"))',
src/libcore/result.rs:999:5
stack backtrace:
0:
1:
2:
3:
4:
5:
6:
7:
8: main
9: __libc_start_main
10:

Temp file creation issue on start

When attempt to make temp file in mcfly.bash is made it ends up with this error:

mktemp: cannot create temp file /tmp/mcfly.XXXX: Invalid argument

Googling a bit showed, that adding more X to the temp file creation command solves the problem.

I'm using Slackware Linux x64.

Delete item from history interactively

When I am in the history viewer, I would like to be able to select an item in the list with the arrow keys, hit the delete key, and have it removed from history.

Last exit code return 1 - mcfly.bash

Seems return exit code 1 when . ./{path to mcfly.bash} execute in .bashrc
The last exit code 1 disappear if I comment this line in mcfly.bash :

...
PROMPT_COMMAND="__last_exit=\$?;history -a \$MCFLY_HISTORY;mcfly add -
-exit \$__last_exit --append-to-histfile;history -cr \$MCFLY_HISTORY;$
{PROMPT_COMMAND}"
...

...but It does affect the program, myfly can;t save lastest history

Remove itself from ".bash_history"

I'm seeing #mcfly: entries, when using history command.

Since McFly does regenerate .bash_history file used by history command, then it likely could remove mentions to itself from there.

Permissions error on startup

Hi, I just installed mcfly to try it out on macOS 10.14.2 (beta 18C52a). I opened a new shell, and saw the "reading history for the first time" message. I closed that shell and opened another, and saw this message:

-bash: /var/folders/kb/bswbcrr56ld5cv7zzhyp57gr0000gn/T/mcfly.XXXX.qqMnwGRv: cannot overwrite existing file

If I remove the file, and open another shell, I get a message with a similar file name. When I ls -l the permissions string is -rw------- for the file, and drwx------@ 254 gwk staff 8128 Dec 3 19:02 T for the parent T directory. Any ideas?

Light mode

Really enjoying mcfly, thanks for making it!

With the Solarized Light color scheme, all of the un-highlighted suggestions are invisible (see attached images).

screenshot 2018-12-04 10 01 18

screenshot 2018-12-04 10 00 59

If this isn't a priority for you, I'd be happy to hack on it some time.

I poked a bit through interface.rs and settings.rs. From a cursory examination, seems like one way to add a light mode would be for settings.rs to look for an environment variable (MCFLY_LIGHT?) around here, set a bool in settings, and then for menubar() prompt() and results() to act accordingly. Would that be your preferred way of propagating a setting like that?

Support zsh

/usr/local/opt/mcfly/mcfly.bash:23: command not found: shopt
/usr/local/opt/mcfly/mcfly.bash:47: command not found: bind

Question: Any issues with "HISTCONTROL=ignoreboth"?

I have HISTCONTROL=ignoreboth (acts as ignorespace;ignoredups) in my .bash_profile file to avoid seeing same command again and again, when browsing through history using Up/Down arrows when I've executed same command several times.

As I've noticed it that takes priority over HISTCONTROL=ignorespace set in mcfly.bash.

Would that cause any problems to McFly ability to detect multiple sequential same command execution attempts and therefore increase probability for suggesting that command over other commands?

Unable to add cmd_tpl to commands: SqliteFailure

On Linux/Debian i have the following problem:

# RUST_BACKTRACE=1 mcfly -d search

McFly: Upgrading McFly DB to version 3, please wait...thread 'main' panicked at 'Unable to add cmd_tpl to commands: SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some("duplicate column name: cmd_tpl"))', libcore/result.rs:1009:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:71
   2: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:227
             at libstd/panicking.rs:476
   3: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:390
   4: rust_begin_unwind
             at libstd/panicking.rs:325
   5: core::panicking::panic_fmt
             at libcore/panicking.rs:77
   6: core::result::unwrap_failed
   7: mcfly::main
   8: std::rt::lang_start::{{closure}}
   9: main
  10: __libc_start_main
  11: _start
McFly: Upgrading McFly DB to version 3, please wait...thread 'main' panicked at 'Unable to add cmd_tpl to commands: SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some("duplicate column name: cmd_tpl"))', libcore/result.rs:1009:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Case sensitive match

Just a feature request: Similar to what some editor's autocomplete does, when the user types in all lowercase letters, behaves case insensitively by default. But if the input contains any uppercase letters, switches to case sensitive mode by giving each exactly matched character some extra points so those candidates rank higher on the list.

This is useful when the command starts with an environment variable, e.g., RUST_LOG=....

Mac issues

Great idea! Tried it on my Mac with bash from homebrew (4.4.23(1)-release) and faced a few issues:

  1. tr fails here: https://github.com/cantino/mcfly/blob/master/mcfly.bash#L8 with tr: Illegal byte sequence. Seems like LC_CTYPE is not enough, need to set LC_ALL=C, it seems to work that way.

  2. After pressing ctrl-r and ctrl-g to get back to the shell, I see this:

    [2018-12-04 02:25:56][prod] konstantin:~
    $ #mcfly:
    [2018-12-04 02:25:59][prod] konstantin:~
    $  mcfly search
    [2018-12-04 02:26:06][prod] konstantin:~
    $
    

    Looks like in this line: https://github.com/cantino/mcfly/blob/master/mcfly.bash#L47 it is executing commands quite literally in the shell, displaying what it's doing. Not sure if it's a mac funkiness or my particular setup or what, but it's annoying.

  3. In standard bash, after pressing ctrl-r and typing something I can keep scrolling back in time by pressing ctrl-r again, and I have a spinal reflex for that. mcfly just drops me back out to the shell, rendering itself effectively unusable for me.

Thanks for your effort. I will try to keep using it, despite the third point, and report what I find.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.