Struct package_bootstrap::Bootstrap
source · pub struct Bootstrap { /* private fields */ }Expand description
a command installer
Implementations§
source§impl Bootstrap
impl Bootstrap
pub fn new(name: &str, cli: Command) -> Self
sourcepub fn completions<P: Deref<Target = Path>>(
&self,
dir: P
) -> Result<(), Box<dyn Error>>
pub fn completions<P: Deref<Target = Path>>( &self, dir: P ) -> 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"))
.completions(std::path::Path::new("/usr"))?;
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"))
.completions(std::path::Path::new("staging/usr"))?;
Ok(())
}