pub struct CommandHelper { /* private fields */ }Implementations§
source§impl CommandHelper
impl CommandHelper
pub fn app(&self) -> &Command
sourcepub fn cwd(&self) -> &Path
pub fn cwd(&self) -> &Path
Canonical form of the current working directory path.
A loaded Workspace::workspace_root() also returns a canonical path, so
relative paths can be easily computed from these paths.
pub fn string_args(&self) -> &Vec<String>
pub fn matches(&self) -> &ArgMatches
pub fn global_args(&self) -> &GlobalArgs
pub fn settings(&self) -> &UserSettings
pub fn resolved_config_values( &self, prefix: &ConfigNamePathBuf, ) -> Result<Vec<AnnotatedValue>, ConfigError>
pub fn revset_extensions(&self) -> &Arc<RevsetExtensions>
sourcepub fn parse_template<'a, C: Clone + 'a, L: TemplateLanguage<'a> + ?Sized>(
&self,
ui: &Ui,
language: &L,
template_text: &str,
wrap_self: impl Fn(PropertyPlaceholder<C>) -> L::Property,
) -> Result<TemplateRenderer<'a, C>, CommandError>
pub fn parse_template<'a, C: Clone + 'a, L: TemplateLanguage<'a> + ?Sized>( &self, ui: &Ui, language: &L, template_text: &str, wrap_self: impl Fn(PropertyPlaceholder<C>) -> L::Property, ) -> Result<TemplateRenderer<'a, C>, CommandError>
Parses template of the given language into evaluation tree.
This function also loads template aliases from the settings. Use
WorkspaceCommandHelper::parse_template() if you’ve already
instantiated the workspace helper.
pub fn workspace_loader(&self) -> Result<&dyn WorkspaceLoader, CommandError>
sourcepub fn workspace_helper(
&self,
ui: &Ui,
) -> Result<WorkspaceCommandHelper, CommandError>
pub fn workspace_helper( &self, ui: &Ui, ) -> Result<WorkspaceCommandHelper, CommandError>
Loads workspace and repo, then snapshots the working copy if allowed.
sourcepub fn workspace_helper_no_snapshot(
&self,
ui: &Ui,
) -> Result<WorkspaceCommandHelper, CommandError>
pub fn workspace_helper_no_snapshot( &self, ui: &Ui, ) -> Result<WorkspaceCommandHelper, CommandError>
Loads workspace and repo, but never snapshots the working copy. Most
commands should use workspace_helper() instead.
pub fn get_working_copy_factory( &self, ) -> Result<&dyn WorkingCopyFactory, CommandError>
pub fn load_workspace(&self) -> Result<Workspace, CommandError>
sourcepub fn workspace_environment(
&self,
ui: &Ui,
workspace: &Workspace,
) -> Result<WorkspaceCommandEnvironment, CommandError>
pub fn workspace_environment( &self, ui: &Ui, workspace: &Workspace, ) -> Result<WorkspaceCommandEnvironment, CommandError>
Loads command environment for the given workspace.
sourcepub fn is_working_copy_writable(&self) -> bool
pub fn is_working_copy_writable(&self) -> bool
Returns true if the working copy to be loaded is writable, and therefore should usually be snapshotted.
sourcepub fn is_at_head_operation(&self) -> bool
pub fn is_at_head_operation(&self) -> bool
Returns true if the current operation is considered to be the head.
sourcepub fn resolve_operation(
&self,
ui: &Ui,
repo_loader: &RepoLoader,
) -> Result<Operation, CommandError>
pub fn resolve_operation( &self, ui: &Ui, repo_loader: &RepoLoader, ) -> Result<Operation, CommandError>
Resolves the current operation from the command-line argument.
If no --at-operation is specified, the head operations will be
loaded. If there are multiple heads, they’ll be merged.
sourcepub fn for_workable_repo(
&self,
ui: &Ui,
workspace: Workspace,
repo: Arc<ReadonlyRepo>,
) -> Result<WorkspaceCommandHelper, CommandError>
pub fn for_workable_repo( &self, ui: &Ui, workspace: Workspace, repo: Arc<ReadonlyRepo>, ) -> Result<WorkspaceCommandHelper, CommandError>
Creates helper for the repo whose view is supposed to be in sync with
the working copy. If --ignore-working-copy is not specified, the
returned helper will attempt to update the working copy.
Trait Implementations§
source§impl Clone for CommandHelper
impl Clone for CommandHelper
source§fn clone(&self) -> CommandHelper
fn clone(&self) -> CommandHelper
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CommandHelper
impl !RefUnwindSafe for CommandHelper
impl !Send for CommandHelper
impl !Sync for CommandHelper
impl Unpin for CommandHelper
impl !UnwindSafe for CommandHelper
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more