-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Return String from
fuzzy_finder::run()
- Loading branch information
Showing
7 changed files
with
50 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
mod controller; | ||
mod fuzzy_finder; | ||
mod models; | ||
mod usecase; | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub(super) mod fuzzy_finder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use crate::{ | ||
models::makefile::Makefile, usecase::fzf_make::fuzzy_finder, usecase::usecase::Usecase, | ||
}; | ||
use colored::*; | ||
use std::process; | ||
|
||
pub struct FzfMake; | ||
|
||
impl Usecase for FzfMake { | ||
fn command_str(&self) -> Vec<&'static str> { | ||
vec![] | ||
} | ||
|
||
fn run(&self) { | ||
let makefile = match Makefile::create_makefile() { | ||
Err(e) => { | ||
println!("[ERR] {}", e.to_string()); | ||
process::exit(1) | ||
} | ||
Ok(f) => f, | ||
}; | ||
|
||
let target = fuzzy_finder::run(makefile); | ||
|
||
println!("{}", ("make ".to_string() + &target).blue()); // TODO: Make output color configurable via config file | ||
process::Command::new("make") | ||
.stdin(process::Stdio::inherit()) | ||
.arg(target) | ||
.spawn() | ||
.expect("Failed to execute process") | ||
.wait() | ||
.expect("Failed to execute process"); | ||
} | ||
} | ||
|
||
impl FzfMake { | ||
pub fn new() -> Self { | ||
Self {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters