-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add isolate_post_checkout color warning messages
Add isolate_post_checkout colored warning messages in the isolate process so that users would be provided useful information about the isolate_post_checkout hook. The approach was simply adding the warning messages to the isolate command so that the would appear when used via any of the other commands, e.g. isolate, request-review, integrate. To do this I first needed to define the print_warn() function which then turned into extracting the ps::private::utils into a directory module rather than a single file. Once that was complete I was able to use the new print_warn() funtion to actually print the warning messages. This relates to issue #79. [changelog] added: isolate_post_checkout color warning messages ps-id: 389b2a94-2e3e-4e55-9085-e0a6d12b7469
- Loading branch information
1 parent
bfbe489
commit 8d65a4c
Showing
13 changed files
with
84 additions
and
39 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,9 +1,9 @@ | ||
use gps as ps; | ||
use super::utils::print_err; | ||
|
||
pub fn isolate(patch_index: Option<usize>) { | ||
let res = ps::isolate(patch_index); | ||
match res { | ||
pub fn isolate(patch_index: Option<usize>, color: bool) { | ||
match ps::isolate(patch_index, color) { | ||
Ok(_) => {}, | ||
Err(e) => eprintln!("Error: {:?}", e) | ||
Err(e) => print_err(color, format!("\nError: {:?}\n", e).as_str()) | ||
} | ||
} |
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 |
---|---|---|
|
@@ -7,4 +7,3 @@ pub fn print_err(color: bool, message: &str) { | |
eprintln!("{}", message) | ||
} | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub trait Mergable { | ||
fn merge(&self, b: &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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
mod execute; | ||
mod mergable; | ||
mod print_warn; | ||
|
||
pub use execute::{execute, ExecuteError}; | ||
pub use mergable::Mergable; | ||
pub use print_warn::print_warn; |
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,10 @@ | ||
use ansi_term::Colour::Yellow; | ||
|
||
pub fn print_warn(color: bool, message: &str) { | ||
if color { | ||
eprintln!("{}", Yellow.paint(message)) | ||
} else { | ||
eprintln!("{}", message) | ||
} | ||
} | ||
|
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