diff options
Diffstat (limited to 'cli/args/flags.rs')
-rw-r--r-- | cli/args/flags.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 837bfe315..bae105915 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -117,6 +117,13 @@ pub struct FmtFlags { pub no_semicolons: Option<bool>, } +impl FmtFlags { + pub fn is_stdin(&self) -> bool { + let args = &self.files.include; + args.len() == 1 && args[0].to_string_lossy() == "-" + } +} + #[derive(Clone, Debug, Eq, PartialEq)] pub struct InitFlags { pub dir: Option<String>, @@ -154,6 +161,13 @@ pub struct LintFlags { pub compact: bool, } +impl LintFlags { + pub fn is_stdin(&self) -> bool { + let args = &self.files.include; + args.len() == 1 && args[0].to_string_lossy() == "-" + } +} + #[derive(Clone, Debug, Eq, PartialEq)] pub struct ReplFlags { pub eval_files: Option<Vec<String>>, |