Add documentation to Runtime type
This commit is contained in:
parent
50b0ac1d18
commit
9495fc0443
1 changed files with 29 additions and 1 deletions
|
@ -47,7 +47,17 @@ impl<'a> Runtime<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* appname should be "imag-foo"
|
* Get a commandline-interface builder object from `clap`
|
||||||
|
*
|
||||||
|
* This commandline interface builder object already contains some predefined interface flags:
|
||||||
|
* * -v | --verbose for verbosity
|
||||||
|
* * --debug for debugging
|
||||||
|
* * -c <file> | --config <file> for alternative configuration file
|
||||||
|
* * -r <path> | --rtp <path> for alternative runtimepath
|
||||||
|
* * --store <path> for alternative store path
|
||||||
|
* Each has the appropriate help text included.
|
||||||
|
*
|
||||||
|
* The `appname` shall be "imag-<command>".
|
||||||
*/
|
*/
|
||||||
pub fn get_default_cli_builder(appname: &'a str,
|
pub fn get_default_cli_builder(appname: &'a str,
|
||||||
version: &'a str,
|
version: &'a str,
|
||||||
|
@ -92,6 +102,9 @@ impl<'a> Runtime<'a> {
|
||||||
.takes_value(true))
|
.takes_value(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the internal logger
|
||||||
|
*/
|
||||||
pub fn init_logger(&self) {
|
pub fn init_logger(&self) {
|
||||||
let lvl = if self.is_debugging() {
|
let lvl = if self.is_debugging() {
|
||||||
LogLevelFilter::Debug
|
LogLevelFilter::Debug
|
||||||
|
@ -112,22 +125,37 @@ impl<'a> Runtime<'a> {
|
||||||
.ok();
|
.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the verbosity flag value
|
||||||
|
*/
|
||||||
pub fn is_verbose(&self) -> bool {
|
pub fn is_verbose(&self) -> bool {
|
||||||
self.cli_matches.is_present("verbosity")
|
self.cli_matches.is_present("verbosity")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the debugging flag value
|
||||||
|
*/
|
||||||
pub fn is_debugging(&self) -> bool {
|
pub fn is_debugging(&self) -> bool {
|
||||||
self.cli_matches.is_present("debugging")
|
self.cli_matches.is_present("debugging")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the runtimepath
|
||||||
|
*/
|
||||||
pub fn rtp(&self) -> &PathBuf {
|
pub fn rtp(&self) -> &PathBuf {
|
||||||
&self.rtp
|
&self.rtp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the commandline interface matches
|
||||||
|
*/
|
||||||
pub fn cli(&self) -> &ArgMatches {
|
pub fn cli(&self) -> &ArgMatches {
|
||||||
&self.cli_matches
|
&self.cli_matches
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the store object
|
||||||
|
*/
|
||||||
pub fn store(&self) -> &Store {
|
pub fn store(&self) -> &Store {
|
||||||
&self.store
|
&self.store
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue