Struct rpf::Prog [] [src]

pub struct Prog {
    pub name: &'static str,
    pub vers: &'static str,
    pub yr: &'static str,
}

A structure for storing rpfram information

Example

use rpf::Prog;

static UTIL: Prog = Prog { name: "util", vers: "0.1.0", yr: "2015" };
assert_eq!(UTIL.name, "util");
assert_eq!(UTIL.vers, "0.1.0");
assert_eq!(UTIL.yr, "2015");

Fields

Name of program

Version of program

Year of copyright for program

Methods

impl Prog
[src]

Prints copyright, version, and author information

Example

use rpf::Prog;

let prog = Prog { name: "util", vers: "0.1.0", yr: "2015" };
prog.copyright(
"Copyright (C) 2015 util developers\n\
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n\
This is free software: you are free to change and redistribute it.\n\
There is NO WARRANTY, to the extent permitted by law.\n", &["Author"]);

Would print the following:

util 0.1.0
Copyright (C) 2015 util developers
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Author

Used for when no arguments are given to a util

Example

use rpf::Prog;

let prog = Prog { name: "util", vers: "0.1.0", yr: "2015" };
prog.prog_try();

Would print the following:

util: Missing arguments
Try util --help for more information

Wrapper for process::exit, immediately exits the process with the set exit status.

Example

use rpf::{Prog,Exit,ExitStatus};

let prog = Prog { name: "test", vers: "0.1.0", yr: "2015" };
prog.exit(ExitStatus::Ok);

Trait Implementations

impl<T: AsRef<str>> Exit<T> for Prog
[src]

Used for errors, prints error messages in red terminal font and calls rpf::Exit::exit Read more

Used for errors when working with paths, works similar to error