@@ -154,6 +154,7 @@ use crate::command_error::user_error;
154154use crate :: command_error:: user_error_with_hint;
155155use crate :: commit_templater:: CommitTemplateLanguage ;
156156use crate :: commit_templater:: CommitTemplateLanguageExtension ;
157+ use crate :: status_templater:: StatusTemplateLanguage ;
157158use crate :: complete;
158159use crate :: config:: ConfigArgKind ;
159160use crate :: config:: ConfigEnv ;
@@ -995,6 +996,17 @@ impl WorkspaceCommandEnvironment {
995996 )
996997 }
997998
999+ /// Creates status template language environment for this workspace and the
1000+ /// given `repo`.
1001+ pub fn status_template_language < ' a > (
1002+ & ' a self ,
1003+ repo : & ' a dyn Repo ,
1004+ id_prefix_context : & ' a IdPrefixContext ,
1005+ ) -> StatusTemplateLanguage < ' a > {
1006+ let commit_language = self . commit_template_language ( repo, id_prefix_context) ;
1007+ StatusTemplateLanguage :: new ( commit_language)
1008+ }
1009+
9981010 pub fn operation_template_extensions ( & self ) -> & [ Arc < dyn OperationTemplateLanguageExtension > ] {
9991011 & self . command . data . operation_template_extensions
10001012 }
@@ -1720,12 +1732,28 @@ to the current parents may contain changes from multiple commits.
17201732 self . parse_template ( ui, & language, template_text)
17211733 }
17221734
1735+ /// Parses status template into evaluation tree.
1736+ pub fn parse_status_template (
1737+ & self ,
1738+ ui : & Ui ,
1739+ template_text : & str ,
1740+ ) -> Result < TemplateRenderer < ' _ , crate :: status_templater:: WorkingCopyStatus > , CommandError > {
1741+ let language = self . status_template_language ( ) ;
1742+ self . parse_template ( ui, & language, template_text)
1743+ }
1744+
17231745 /// Creates commit template language environment for this workspace.
17241746 pub fn commit_template_language ( & self ) -> CommitTemplateLanguage < ' _ > {
17251747 self . env
17261748 . commit_template_language ( self . repo ( ) . as_ref ( ) , self . id_prefix_context ( ) )
17271749 }
17281750
1751+ /// Creates status template language environment for this workspace.
1752+ pub fn status_template_language ( & self ) -> StatusTemplateLanguage < ' _ > {
1753+ self . env
1754+ . status_template_language ( self . repo ( ) . as_ref ( ) , self . id_prefix_context ( ) )
1755+ }
1756+
17291757 /// Creates operation template language environment for this workspace.
17301758 pub fn operation_template_language ( & self ) -> OperationTemplateLanguage {
17311759 OperationTemplateLanguage :: new (
0 commit comments