pub struct Bootstrap { /* private fields */ }
Expand description
a command installer
Implementations§
Source§impl Bootstrap
impl Bootstrap
pub fn new<P: AsRef<OsStr>>(name: &str, cli: Command, outdir: P) -> Self
Sourcepub fn completions(&self) -> Result<(), Box<dyn Error>>
pub fn completions(&self) -> Result<(), Box<dyn Error>>
Generates and installs shell completions for all supported shells into
dir
.
§Examples
To install shell completions under /usr:
use package_bootstrap::Bootstrap;
fn main() -> Result<(), Box<dyn std::error::Error>> {
Bootstrap::new("foo", clap::Command::new("foo"), "/usr")
.completions()?;
Ok(())
}
To install into a staging directory for packaging purposes:
use package_bootstrap::Bootstrap;
fn main() -> Result<(), Box<dyn std::error::Error>> {
Bootstrap::new("foo", clap::Command::new("foo"), "staging/usr")
.completions()?;
Ok(())
}
Sourcepub fn translations<P: AsRef<Path>>(
&self,
podir: P,
) -> Result<(), Box<dyn Error>>
pub fn translations<P: AsRef<Path>>( &self, podir: P, ) -> Result<(), Box<dyn Error>>
Compiles and installs translations into
Sourcepub fn docfiles<P: AsRef<Path> + AsRef<OsStr>>(
&self,
files: &[P],
doc_subdir: &Path,
) -> Result<(), Box<dyn Error>>
pub fn docfiles<P: AsRef<Path> + AsRef<OsStr>>( &self, files: &[P], doc_subdir: &Path, ) -> Result<(), Box<dyn Error>>
Copies a slice of files to a documentation subdirectory.
§Example
Copy this crate’s README and LICENSE files into
use package_bootstrap::Bootstrap;
use std::error::Error;
use std::path::Path;
fn main() -> Result<(), Box<dyn Error>> {
Bootstrap::new("foo", clap::Command::new("foo"), "pkg/usr")
.docfiles(&["README.md", "LICENSE.md"], &Path::new("foo"))?;
Ok(())
}
Auto Trait Implementations§
impl Freeze for Bootstrap
impl !RefUnwindSafe for Bootstrap
impl Send for Bootstrap
impl Sync for Bootstrap
impl Unpin for Bootstrap
impl !UnwindSafe for Bootstrap
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
Mutably borrows from an owned value. Read more