Struct cargo_generate::TemplatePath
source · pub struct TemplatePath {
pub auto_path: Option<String>,
pub subfolder: Option<String>,
pub test: bool,
pub git: Option<String>,
pub branch: Option<String>,
pub tag: Option<String>,
pub revision: Option<String>,
pub path: Option<String>,
pub favorite: Option<String>,
}
Fields§
§auto_path: Option<String>
Auto attempt to use as either --git
or --favorite
. If either is specified explicitly,
use as subfolder.
subfolder: Option<String>
Specifies the subfolder within the template repository to be used as the actual template.
test: bool
Expand $CWD as a template, then run cargo test
on the expansion (set
$CARGO_GENERATE_TEST_CMD to override test command).
Any arguments given after the --test
argument, will be used as arguments for the test
command.
git: Option<String>
Git repository to clone template from. Can be a URL (like
https://github.com/rust-cli/cli-template
), a path (relative or absolute), or an
owner/repo
abbreviated GitHub URL (like rust-cli/cli-template
).
Note that cargo generate will first attempt to interpret the owner/repo
form as a
relative path and only try a GitHub URL if the local path doesn’t exist.
branch: Option<String>
Branch to use when installing from git
tag: Option<String>
Tag to use when installing from git
revision: Option<String>
Git revision to use when installing from git (e.g. a commit hash)
path: Option<String>
Local path to copy the template from. Can not be specified together with –git.
favorite: Option<String>
Generate a favorite template as defined in the config. In case the favorite is undefined,
use in place of the --git
option, otherwise specifies the subfolder
Implementations§
source§impl TemplatePath
impl TemplatePath
sourcepub fn any_path(&self) -> &str
pub fn any_path(&self) -> &str
§Panics
Will panic if no path to a template has been set at all, which is never if Clap is initialized properly.
pub const fn git(&self) -> Option<&(impl AsRef<str> + '_)>
pub const fn branch(&self) -> Option<&(impl AsRef<str> + '_)>
pub const fn tag(&self) -> Option<&(impl AsRef<str> + '_)>
pub const fn revision(&self) -> Option<&(impl AsRef<str> + '_)>
pub const fn path(&self) -> Option<&(impl AsRef<str> + '_)>
pub const fn favorite(&self) -> Option<&(impl AsRef<str> + '_)>
pub const fn auto_path(&self) -> Option<&(impl AsRef<str> + '_)>
pub const fn subfolder(&self) -> Option<&(impl AsRef<str> + '_)>
Trait Implementations§
source§impl Args for TemplatePath
impl Args for TemplatePath
source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
source§impl Clone for TemplatePath
impl Clone for TemplatePath
source§fn clone(&self) -> TemplatePath
fn clone(&self) -> TemplatePath
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TemplatePath
impl Debug for TemplatePath
source§impl Default for TemplatePath
impl Default for TemplatePath
source§fn default() -> TemplatePath
fn default() -> TemplatePath
source§impl FromArgMatches for TemplatePath
impl FromArgMatches for TemplatePath
source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches
to self
.source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches
to self
.Auto Trait Implementations§
impl Freeze for TemplatePath
impl RefUnwindSafe for TemplatePath
impl Send for TemplatePath
impl Sync for TemplatePath
impl Unpin for TemplatePath
impl UnwindSafe for TemplatePath
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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