release_manager/
commandline.rs

1// This file is part of Release Manager
2
3// Release Manager is free software: you can redistribute it and/or modify
4// it under the terms of the GNU General Public License as published by
5// the Free Software Foundation, either version 3 of the License, or
6// (at your option) any later version.
7
8// Release Manager is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11// GNU General Public License for more details.
12
13// You should have received a copy of the GNU General Public License
14// along with Release Manager  If not, see <http://www.gnu.org/licenses/>.
15
16#[derive(StructOpt, Debug)]
17#[structopt(name = "release-manager",
18            about = "A utility for creating release binaries for multiple platforms")]
19pub struct Opt {
20    #[structopt(short = "f", long = "force", help = "Force recompiling of succeeded builds")]
21    force_compile: bool,
22    #[structopt(long = "skip-dependencies", help = "Don't compile dependencies unless needed")]
23    skip_dependencies: bool,
24    #[structopt(short = "p", long = "publish", help = "Publish to crates.io on succesfull build")]
25    publish: bool,
26    #[structopt(long = "verbose", help = "Print debug info")]
27    verbose: bool,
28    #[structopt(short = "r", long = "release-config",
29                help = "Provide an alternative path for the release config")]
30    release_config: Option<String>,
31    #[structopt(short = "s", long = "status-file",
32                help = "Provide an alternative path for the status file")]
33    status_file: Option<String>,
34}
35
36impl Opt {
37    pub fn force_compile(&self) -> bool {
38        self.force_compile
39    }
40
41    pub fn publish(&self) -> bool {
42        self.publish
43    }
44
45    pub fn verbose(&self) -> bool {
46        self.verbose
47    }
48
49    pub fn skip_dependencies(&self) -> bool {
50        self.skip_dependencies
51    }
52
53    pub fn release_config(&self) -> Option<&str> {
54        match self.release_config {
55            Some(ref rc) => Some(rc),
56            None => None,
57        }
58    }
59
60    pub fn status_file(&self) -> Option<&str> {
61        match self.status_file {
62            Some(ref rc) => Some(rc),
63            None => None,
64        }
65    }
66}