mirror of
https://github.com/rizsotto/Bear.git
synced 2025-12-12 20:35:47 +01:00
rust: rename semantic+intercept mode to combined
This commit is contained in:
@@ -36,7 +36,7 @@ pub enum Mode {
|
||||
input: BuildEvents,
|
||||
output: BuildSemantic,
|
||||
},
|
||||
All {
|
||||
Combined {
|
||||
input: BuildCommand,
|
||||
output: BuildSemantic,
|
||||
},
|
||||
@@ -98,7 +98,7 @@ impl TryFrom<ArgMatches> for Arguments {
|
||||
None => {
|
||||
let input = BuildCommand::try_from(&matches)?;
|
||||
let output = BuildSemantic::try_from(&matches)?;
|
||||
let mode = Mode::All { input, output };
|
||||
let mode = Mode::Combined { input, output };
|
||||
let arguments = Arguments { config, mode };
|
||||
Ok(arguments)
|
||||
}
|
||||
@@ -334,7 +334,7 @@ mod test {
|
||||
arguments,
|
||||
Arguments {
|
||||
config: Some("~/bear.yaml".to_string()),
|
||||
mode: Mode::All {
|
||||
mode: Mode::Combined {
|
||||
input: BuildCommand {
|
||||
arguments: vec_of_strings!["make", "all"]
|
||||
},
|
||||
@@ -358,7 +358,7 @@ mod test {
|
||||
arguments,
|
||||
Arguments {
|
||||
config: None,
|
||||
mode: Mode::All {
|
||||
mode: Mode::Combined {
|
||||
input: BuildCommand {
|
||||
arguments: vec_of_strings!["make", "all"]
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
use bear::modes::{All, Intercept, Mode, Semantic};
|
||||
use bear::modes::{Combined, Intercept, Mode, Semantic};
|
||||
use bear::{args, config};
|
||||
use std::env;
|
||||
use std::process::ExitCode;
|
||||
@@ -36,7 +36,7 @@ fn main() -> anyhow::Result<ExitCode> {
|
||||
enum Application {
|
||||
Intercept(Intercept),
|
||||
Semantic(Semantic),
|
||||
All(All),
|
||||
Combined(Combined),
|
||||
}
|
||||
|
||||
impl Application {
|
||||
@@ -55,9 +55,9 @@ impl Application {
|
||||
log::debug!("Mode: semantic analysis");
|
||||
Semantic::from(input, output, config).map(Application::Semantic)
|
||||
}
|
||||
args::Mode::All { input, output } => {
|
||||
args::Mode::Combined { input, output } => {
|
||||
log::debug!("Mode: intercept and semantic analysis");
|
||||
All::from(input, output, config).map(Application::All)
|
||||
Combined::from(input, output, config).map(Application::Combined)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ impl Application {
|
||||
let status = match self {
|
||||
Application::Intercept(intercept) => intercept.run(),
|
||||
Application::Semantic(semantic) => semantic.run(),
|
||||
Application::All(all) => all.run(),
|
||||
Application::Combined(all) => all.run(),
|
||||
};
|
||||
match status {
|
||||
Ok(code) => code,
|
||||
|
||||
@@ -141,7 +141,7 @@ impl Mode for Semantic {
|
||||
}
|
||||
|
||||
/// The all model is combining the intercept and semantic modes.
|
||||
pub struct All {
|
||||
pub struct Combined {
|
||||
command: args::BuildCommand,
|
||||
intercept_config: config::Intercept,
|
||||
semantic_recognition: Recognition,
|
||||
@@ -149,7 +149,7 @@ pub struct All {
|
||||
output_writer: OutputWriter,
|
||||
}
|
||||
|
||||
impl All {
|
||||
impl Combined {
|
||||
/// Create a new all mode instance.
|
||||
pub fn from(
|
||||
command: args::BuildCommand,
|
||||
@@ -188,7 +188,7 @@ impl All {
|
||||
}
|
||||
}
|
||||
|
||||
impl Mode for All {
|
||||
impl Mode for Combined {
|
||||
/// Run the all mode by setting up the collector service and the intercept environment.
|
||||
/// The build command is executed in the intercept environment. The collected events are
|
||||
/// then processed by the semantic recognition and transformation. The result is written
|
||||
|
||||
Reference in New Issue
Block a user