Add support for Alfred (#347)

This commit is contained in:
Denis Isidoro 2020-04-19 15:51:04 -03:00 committed by GitHub
parent 019adf82cf
commit c7f919eaa0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 850 additions and 54 deletions

View file

@ -3,7 +3,7 @@ use thiserror::Error;
#[derive(Error, Debug)]
#[error(
"\rHey listen! Navi encountered a problem.
"\rHey, listen! Navi encountered a problem.
Do you think this is a bug? File an issue at https://github.com/denisidoro/navi."
)]
pub struct FileAnIssue {

5
src/structures/item.rs Normal file
View file

@ -0,0 +1,5 @@
pub struct Item<'a> {
pub tags: &'a str,
pub comment: &'a str,
pub snippet: &'a str,
}

View file

@ -2,4 +2,5 @@ pub mod cheat;
pub mod error;
pub mod finder;
pub mod fnv;
pub mod item;
pub mod option;

View file

@ -106,6 +106,11 @@ pub enum Command {
/// bash, zsh or fish
shell: String,
},
/// Alfred
Alfred {
#[structopt(subcommand)]
cmd: AlfredCommand,
},
}
#[derive(Debug, StructOpt)]
@ -119,6 +124,16 @@ pub enum RepoCommand {
Browse,
}
#[derive(Debug, StructOpt)]
pub enum AlfredCommand {
/// Start
Start,
/// Suggestions
Suggestions,
/// Transform
Transform,
}
pub fn config_from_env() -> Config {
Config::from_args()
}