buster / rrun

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

Completions can be configured via .toml file #9

Closed nightscape closed 8 years ago

nightscape commented 8 years ago

This PR allows specifying completions in a .toml file located in ~/.config/rrun/config.toml. If the file doesn't exist yet, it will be created with a configuration that should be identical to the current behaviour. When there are multiple

[[completion]]
command="..."

sections in the .toml file, hitting TAB will iterate over all completions.

This PR should already allow for using zsh for completions (I have to figure out how though). Next planned steps would be to define a trigger field for each completion (probably a regex) that determines if this completion can be applied and a runner that will be used for the given completion. Then one could e.g. define a trigger like [0-9+-*/.()]+ for numeric calculations and feed those into qcalc directly.

buster commented 8 years ago

Thanks @nightscape! I'll look into your PRs in more detail this evening. I should also add you to a "Contributors" section in the README.

buster commented 8 years ago

Hi @nightscape,

i never did this, but apparently you can do pull requests to a branch in rrun, according to http://stackoverflow.com/questions/9135913/merge-pull-request-to-a-different-branch-than-default-in-github

That way i could also work on the pull request for refining things..

Anyway, i'm creating a branch for this... see https://github.com/buster/rrun/pull/11

buster commented 8 years ago

Hi @nightscape,

i've just added you to the contributors page, if you would like to work on rrun, feel free :) I'd suggest doing work on branches..

Also, i've refactored your PR a little bit and tried to get rid of some of the many unwrap() calls (most of which are my fault)...