-
-
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: Change
fuzzy_finder::run
to return String
- Loading branch information
Showing
10 changed files
with
67 additions
and
67 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,39 @@ | ||
use crate::models::makefile::Makefile; | ||
use crate::usecase::{fzf_make::fuzzy_finder, usecase::Usecase}; | ||
use colored::*; | ||
use std::process; | ||
|
||
pub struct FzfMake; | ||
|
||
impl FzfMake { | ||
pub fn new() -> Self { | ||
Self {} | ||
} | ||
} | ||
|
||
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"); | ||
} | ||
} |
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
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