forked from mirrors/jj
cli: add method to load template aliases without using WorkspaceCommandHelper
This commit is contained in:
parent
45fdcfd6a8
commit
e8900123d2
1 changed files with 9 additions and 1 deletions
|
@ -579,6 +579,14 @@ impl CommandHelper {
|
||||||
self.layered_configs.resolved_config_values(prefix)
|
self.layered_configs.resolved_config_values(prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Loads template aliases from the configs.
|
||||||
|
///
|
||||||
|
/// For most commands that depend on a loaded repo, you should use
|
||||||
|
/// `WorkspaceCommandHelper::template_aliases_map()` instead.
|
||||||
|
pub fn load_template_aliases(&self, ui: &Ui) -> Result<TemplateAliasesMap, CommandError> {
|
||||||
|
load_template_aliases(ui, &self.layered_configs)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn workspace_loader(&self) -> Result<&WorkspaceLoader, CommandError> {
|
pub fn workspace_loader(&self) -> Result<&WorkspaceLoader, CommandError> {
|
||||||
self.maybe_workspace_loader.as_ref().map_err(Clone::clone)
|
self.maybe_workspace_loader.as_ref().map_err(Clone::clone)
|
||||||
}
|
}
|
||||||
|
@ -737,7 +745,7 @@ impl WorkspaceCommandHelper {
|
||||||
repo: Arc<ReadonlyRepo>,
|
repo: Arc<ReadonlyRepo>,
|
||||||
) -> Result<Self, CommandError> {
|
) -> Result<Self, CommandError> {
|
||||||
let revset_aliases_map = load_revset_aliases(ui, &command.layered_configs)?;
|
let revset_aliases_map = load_revset_aliases(ui, &command.layered_configs)?;
|
||||||
let template_aliases_map = load_template_aliases(ui, &command.layered_configs)?;
|
let template_aliases_map = command.load_template_aliases(ui)?;
|
||||||
// Parse commit_summary template early to report error before starting mutable
|
// Parse commit_summary template early to report error before starting mutable
|
||||||
// operation.
|
// operation.
|
||||||
// TODO: Parsed template can be cached if it doesn't capture repo
|
// TODO: Parsed template can be cached if it doesn't capture repo
|
||||||
|
|
Loading…
Reference in a new issue