Skip to content

Commit

Permalink
cli: call resolved_config_values() directly from cmd_config_list()
Browse files Browse the repository at this point in the history
There's only one caller, and it will become accessible through
command.settings().
  • Loading branch information
yuja committed Nov 25, 2024
1 parent f819dc9 commit 5559b18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
11 changes: 3 additions & 8 deletions cli/src/cli_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ use jj_lib::backend::MergedTreeId;
use jj_lib::backend::TreeValue;
use jj_lib::commit::Commit;
use jj_lib::config::ConfigError;
use jj_lib::config::ConfigNamePathBuf;
use jj_lib::config::ConfigSource;
use jj_lib::conflicts::ConflictMarkerStyle;
use jj_lib::file_util;
Expand Down Expand Up @@ -149,9 +148,7 @@ use crate::commit_templater::CommitTemplateLanguage;
use crate::commit_templater::CommitTemplateLanguageExtension;
use crate::complete;
use crate::config::new_config_path;
use crate::config::AnnotatedValue;
use crate::config::CommandNameAndArgs;
use crate::config::ConfigEnvError;
use crate::config::LayeredConfigs;
use crate::diff_util;
use crate::diff_util::DiffFormat;
Expand Down Expand Up @@ -319,11 +316,9 @@ impl CommandHelper {
&self.data.settings
}

pub fn resolved_config_values(
&self,
prefix: &ConfigNamePathBuf,
) -> Result<Vec<AnnotatedValue>, ConfigEnvError> {
self.data.layered_configs.resolved_config_values(prefix)
// TODO: will be moved to UserSettings
pub fn layered_configs(&self) -> &LayeredConfigs {
&self.data.layered_configs
}

pub fn revset_extensions(&self) -> &Arc<RevsetExtensions> {
Expand Down
5 changes: 4 additions & 1 deletion cli/src/commands/config/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ pub fn cmd_config_list(
let mut formatter = ui.stdout_formatter();
let name_path = args.name.clone().unwrap_or_else(ConfigNamePathBuf::root);
let mut wrote_values = false;
for annotated in command.resolved_config_values(&name_path)? {
for annotated in command
.layered_configs()
.resolved_config_values(&name_path)?
{
// Remove overridden values.
if annotated.is_overridden && !args.include_overridden {
continue;
Expand Down

0 comments on commit 5559b18

Please sign in to comment.