Skip to content

Commit

Permalink
remove --targets flag from analyze
Browse files Browse the repository at this point in the history
  • Loading branch information
pnordahl committed Nov 14, 2024
1 parent 50a34c5 commit 3699abd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 39 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [3.5.1] - 2024-11-14

### Changed
Removed `--target (-t)` flag from `monorail analyze`

## [3.5.0] - 2024-11-13

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "A tool for effective polyglot, multi-project monorepo development
license = "MIT"
homepage = "https://github.com/pnordahl/monorail"
repository = "https://github.com/pnordahl/monorail"
version = "3.5.0"
version = "3.5.1"
authors = ["Patrick Nordahl <[email protected]>"]
edition = "2021"
keywords = ["monorail", "monorepo", "build", "cli", "build-tool"]
Expand Down
16 changes: 1 addition & 15 deletions src/api/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,16 +405,7 @@ See `monorail run -h` for information on how this interacts with other arg-relat
.long(ARG_ALL)
.help("Display changes, change targets, and targets")
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(ARG_TARGETS)
.short('t')
.long(ARG_TARGETS)
.required(false)
.num_args(1..)
.value_delimiter(' ')
.action(ArgAction::Append)
.help("Scope analysis to only the provided targets.")))
))
.subcommand(
Command::new(CMD_OUT)
.about("Manipulate data in the monorail output directory")
Expand Down Expand Up @@ -792,11 +783,6 @@ impl<'a> From<&'a clap::ArgMatches> for app::analyze::HandleAnalyzeInput<'a> {
end: cmd.get_one::<String>(ARG_END).map(|x: &String| x.as_str()),
git_path: cmd.get_one::<String>(ARG_GIT_PATH).unwrap(),
},
targets: cmd
.get_many::<String>(ARG_TARGETS)
.into_iter()
.flatten()
.collect(),
analyze_input: app::analyze::AnalyzeInput {
show_changes: cmd.get_flag(ARG_CHANGES),
show_change_targets: cmd.get_flag(ARG_CHANGE_TARGETS),
Expand Down
37 changes: 14 additions & 23 deletions src/app/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use crate::core::{git, tracking};
pub(crate) struct HandleAnalyzeInput<'a> {
pub(crate) git_opts: git::GitOptions<'a>,
pub(crate) analyze_input: AnalyzeInput,
pub(crate) targets: HashSet<&'a String>,
}

#[derive(Debug)]
Expand Down Expand Up @@ -87,30 +86,22 @@ pub(crate) async fn handle_analyze<'a>(
input: &HandleAnalyzeInput<'a>,
work_path: &'a path::Path,
) -> Result<AnalyzeOutput, MonorailError> {
let (mut index, changes) = match input.targets.len() {
0 => {
let changes = match cfg.change_provider.r#use {
ChangeProviderKind::Git => match cfg.change_provider.r#use {
ChangeProviderKind::Git => {
let tracking = tracking::Table::new(&cfg.get_tracking_path(work_path))?;
let checkpoint = match tracking.open_checkpoint() {
Ok(checkpoint) => Some(checkpoint),
Err(MonorailError::TrackingCheckpointNotFound(_)) => None,
Err(e) => {
return Err(e);
}
};
git::get_git_all_changes(&input.git_opts, &checkpoint, work_path).await?
let changes = match cfg.change_provider.r#use {
ChangeProviderKind::Git => match cfg.change_provider.r#use {
ChangeProviderKind::Git => {
let tracking = tracking::Table::new(&cfg.get_tracking_path(work_path))?;
let checkpoint = match tracking.open_checkpoint() {
Ok(checkpoint) => Some(checkpoint),
Err(MonorailError::TrackingCheckpointNotFound(_)) => None,
Err(e) => {
return Err(e);
}
},
};
(
core::Index::new(cfg, &cfg.get_target_path_set(), work_path)?,
changes,
)
}
_ => (core::Index::new(cfg, &input.targets, work_path)?, None),
};
git::get_git_all_changes(&input.git_opts, &checkpoint, work_path).await?
}
},
};
let mut index = core::Index::new(cfg, &cfg.get_target_path_set(), work_path)?;

analyze(&input.analyze_input, &mut index, changes)
}
Expand Down

0 comments on commit 3699abd

Please sign in to comment.