cli: call resolved_config_values() directly from cmd_config_list()

There's only one caller, and it will become accessible through
command.settings().
This commit is contained in:
Yuya Nishihara 2024-11-23 17:34:37 +09:00
parent ee37409c5e
commit 0df1ac65b5
2 changed files with 7 additions and 9 deletions

View file

@ -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;
@ -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;
@ -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> {

View file

@ -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;