From 996611223234ddb3c88ce6917ae2dcc38bc3fbbd Mon Sep 17 00:00:00 2001 From: grovesNL Date: Thu, 19 Oct 2017 18:53:34 -0600 Subject: [PATCH] Add `is_like_{gnu/clang/msvc}` methods to `Tool` --- src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index efd42a8..5f7d77b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1674,6 +1674,21 @@ impl Tool { pub fn env(&self) -> &[(OsString, OsString)] { &self.env } + + /// Whether the tool is GNU Compiler Collection-like. + pub fn is_like_gnu(&self) -> bool { + self.family == ToolFamily::Gnu + } + + /// Whether the tool is Clang-like. + pub fn is_like_clang(&self) -> bool { + self.family == ToolFamily::Clang + } + + /// Whether the tool is MSVC-like. + pub fn is_like_msvc(&self) -> bool { + self.family == ToolFamily::Msvc + } } fn run(cmd: &mut Command, program: &str) -> Result<(), Error> {