-
-
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(makefile): refactor
Makefile
struct to Runner
enum to be…
… able to add other command runner like pnpm, yarn, etc. #315 (#321) * define Runner trait * wip: Implement Makefile runner * rename: model::Makefile -> model::Make * add: implement Selector for Make * fix: use Selector trait from caller side * rename: makefile -> runners * fix: append_history * fix: narrow_down_targets * fix: app.rs * fix: history x UI周辺を追従 * add: command::Command * fix: comment * wip: trait object * wip: enum * Command * fix: comment * delete: pnpm * comment out history related test code * treat with temporal dead code * delete dead code * fix: how to print command to run * chore: refactor
- Loading branch information
Showing
14 changed files
with
889 additions
and
500 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::{fmt, path::PathBuf}; | ||
|
||
use super::runner_type; | ||
|
||
#[derive(PartialEq, Debug, Clone)] | ||
pub struct Command { | ||
pub runner_type: runner_type::RunnerType, | ||
pub name: String, | ||
pub file_name: PathBuf, | ||
pub line_number: u32, | ||
} | ||
|
||
impl Command { | ||
pub fn new( | ||
runner_type: runner_type::RunnerType, | ||
command_name: String, | ||
file_name: PathBuf, | ||
line_number: u32, | ||
) -> Self { | ||
Self { | ||
runner_type, | ||
name: command_name, | ||
file_name, | ||
line_number, | ||
} | ||
} | ||
} | ||
|
||
impl fmt::Display for Command { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
write!(f, "({}) {}", self.runner_type, self.name) | ||
} | ||
} |
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
Oops, something went wrong.