feat(config): Add fetchResourceEvents config flag with --no-events CLI override
Adds a new boolean field to SyncConfig that controls whether resource event fetching is performed during sync: - SyncConfig.fetch_resource_events: defaults to true via serde default_true helper, serialized as "fetchResourceEvents" in JSON - SyncArgs.no_events: --no-events CLI flag that overrides the config value to false when present - SyncOptions.no_events: propagates the flag through the sync pipeline - handle_sync_cmd: mutates loaded config when --no-events is set, ensuring the flag takes effect regardless of config file contents This follows the existing pattern established by --no-embed and --no-docs flags, where CLI flags override config file defaults. The config is loaded as mutable specifically to support this override. Also adds "events" to the count command's entity type value_parser, enabling `lore count events` (implementation in a separate commit). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
20
src/main.rs
20
src/main.rs
@@ -11,14 +11,14 @@ use tracing_subscriber::util::SubscriberInitExt;
|
||||
use lore::Config;
|
||||
use lore::cli::commands::{
|
||||
InitInputs, InitOptions, InitResult, ListFilters, MrListFilters, SearchCliFilters, open_issue_in_browser,
|
||||
open_mr_in_browser, print_count, print_count_json, print_doctor_results, print_generate_docs,
|
||||
open_mr_in_browser, print_count, print_count_json, print_event_count, print_event_count_json, print_doctor_results, print_generate_docs,
|
||||
print_generate_docs_json, print_ingest_summary, print_ingest_summary_json, print_list_issues,
|
||||
print_list_issues_json, print_list_mrs, print_list_mrs_json, print_search_results,
|
||||
print_search_results_json, print_show_issue, print_show_issue_json, print_show_mr, print_stats,
|
||||
print_stats_json,
|
||||
print_embed, print_embed_json, print_sync, print_sync_json,
|
||||
print_show_mr_json, print_sync_status, print_sync_status_json, run_auth_test, run_count,
|
||||
run_doctor, run_embed, run_generate_docs, run_ingest, run_init, run_list_issues, run_list_mrs,
|
||||
run_count_events, run_doctor, run_embed, run_generate_docs, run_ingest, run_init, run_list_issues, run_list_mrs,
|
||||
run_search, run_show_issue, run_show_mr, run_stats, run_sync, run_sync_status, SyncOptions,
|
||||
IngestDisplay,
|
||||
};
|
||||
@@ -518,6 +518,16 @@ async fn handle_count(
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let config = Config::load(config_override)?;
|
||||
|
||||
if args.entity == "events" {
|
||||
let counts = run_count_events(&config)?;
|
||||
if robot_mode {
|
||||
print_event_count_json(&counts);
|
||||
} else {
|
||||
print_event_count(&counts);
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let result = run_count(&config, &args.entity, args.for_entity.as_deref())?;
|
||||
if robot_mode {
|
||||
print_count_json(&result);
|
||||
@@ -1128,12 +1138,16 @@ async fn handle_sync_cmd(
|
||||
args: SyncArgs,
|
||||
robot_mode: bool,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let config = Config::load(config_override)?;
|
||||
let mut config = Config::load(config_override)?;
|
||||
if args.no_events {
|
||||
config.sync.fetch_resource_events = false;
|
||||
}
|
||||
let options = SyncOptions {
|
||||
full: args.full && !args.no_full,
|
||||
force: args.force && !args.no_force,
|
||||
no_embed: args.no_embed,
|
||||
no_docs: args.no_docs,
|
||||
no_events: args.no_events,
|
||||
robot_mode,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user