buster / rrun

minimalistic command launcher in rust
GNU General Public License v2.0
112 stars 14 forks source link

Nightscape configurable completions #11

Closed buster closed 8 years ago

buster commented 8 years ago

unfortunately, the bash completion is still in the wrong order. When completing for "whi", it finds "while" first on my computer, but "which" should be before (c comes before l in the alphabet")...

nightscape commented 8 years ago

Sorting should be fixed now (via compgen -A command {} | sort | uniq in the config.toml).

nightscape commented 8 years ago

I think the configurable completion and runner stuff works quite nicely now (see config.toml), looking forward to additional ideas on what to complete and run :+1:

One thing that's not so nice yet, is that all completers are called when pressing TAB while theoretically only one would currently be needed (I couldn't convince the borrow checker ;). But with the completions I have in my config it's still super-fast, no noticeable lags.

Usually I rebase branches before merging in order to get a cleaner history, but that's a matter of personal preference. Do you prefer to keep the commits in this branch as they are, or shall I clean up before you click the Merge button?

buster commented 8 years ago

Actually, i am noticing some behaviour about the bash compgen stuff i forgot:

Back when i implemented it i had the impression that it looks like some order... But i don't really see a pattern, except that the last command is the most significant..

[buster@Fry➔ ~/projects/rrun] compgen -A command whi
while
which
whiptail
which
[buster@Fry➔ ~/projects/rrun] compgen -A command chr
chrpath
chrt
chromium
[buster@Fry➔ ~/projects/rrun] compgen -A command dir
dirs
directfb-csource
directfb-config
dirsplit
dirmngr
dirmngr-client
dircolors
dirname
dir
[buster@Fry➔ ~/projects/rrun] compgen -A command mc
mc-tool
mc-wait-for-name
mcomp
mcheck
mcopy
mclasserase
mcd
mcat
mc
mcview
mcdiff
mcedit
mcookie

This is particularly baffling. Why is the direct match "mc" not in the last line?! i don't know. But i can't find much documentation of the output format of compgen, so..

I guess just sorting it is the safest bet...

buster commented 8 years ago

Also, i think rebasing might be nice.. :)

buster commented 8 years ago

Also, it doesn't run on my laptop:

[buster@Fry➔ ~/projects/rrun] cargo run 
   Compiling rrun v0.0.6 (file:///home/buster/projects/rrun)
     Running `target/debug/rrun`
thread '<main>' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:330
Process didn't exit successfully: `target/debug/rrun` (exit code: 101)

In general, whenever you see an unwrap() call you should really think if this is the way to go. We should try to get rid of all unwrap() calls, to be honest..

buster commented 8 years ago

The error was because i had an old ~/.config/rrun/config.toml file. Working now :)

buster commented 8 years ago

I've made some changed which i think make sense. Specifically, i removed the "echo" completion (what was it used for?), set the browser to "x-www-browser" and changed the helper stuff from ruby to python (ruby is not installed by default on all distributions i know of).

buster commented 8 years ago

I've merged all our changes and released version 0.1.0.

Thanks so much for your changes, Martin! I think this PR has become rather big, so i wanted to get those changes into master...