Skip to content

Commit

Permalink
[POC] only show enabled packages, fix name
Browse files Browse the repository at this point in the history
  • Loading branch information
SIMULATAN committed Jan 14, 2023
1 parent c7ddf17 commit f822c93
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/local_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use anyhow::Result;
use dialoguer::MultiSelect;
use crate::args::Options;
use crate::filesystem;
use crate::config::{Configuration, GlobalConfig, load_global_config, load_local_config, LocalConfig, merge_configuration_files, Package};
use crate::config::{GlobalConfig, load_global_config, load_local_config, LocalConfig, Package};

/// Returns true if an error was printed
pub fn config(opt: &Options) -> Result<bool> {
Expand All @@ -17,9 +17,7 @@ pub fn config(opt: &Options) -> Result<bool> {

let mut local_config: LocalConfig = load_local_config(&opt.local_config)?;

// this "config" variable will only contain the ENABLED packages
let config: Configuration = merge_configuration_files(global_config.clone(), local_config.clone(), None)?;
let enabled_packages = config.packages;
let enabled_packages = &local_config.packages;

// all packages, including the ones that are disabled
let packages: Vec<PackageNames> = get_packages(global_config.packages);
Expand All @@ -33,7 +31,7 @@ pub fn config(opt: &Options) -> Result<bool> {

match selected_items {
Some(selected_items) => {
modify_and_save(opt, &mut local_config, packages.iter().map(|(key, _)| key).collect(), selected_items)?;
modify_and_save(opt, &mut local_config, packages.iter().map(|(_, value)| value).collect(), selected_items)?;
}
None => {
// user pressed "Esc" or "q" to quit
Expand Down

0 comments on commit f822c93

Please sign in to comment.