]> git.r.bdr.sh - rbdr/blog/blob - src/command/version.rs
e566c5a4e3cfa6ece8edb957f10a4ca372684669
[rbdr/blog] / src / command / version.rs
1 use std::io::Result;
2 use crate::configuration::Configuration;
3
4 pub struct Version;
5
6 impl Version {
7 pub fn new() -> Self {
8 Version
9 }
10 }
11
12 impl super::Command for Version {
13 fn before_dependencies(&self) -> Vec<Box<dyn super::Command>> {
14 vec![]
15 }
16
17 fn execute(&self, _: Option<&String>, _: &Configuration, _: &String) -> Result<()> {
18 let version = env!("CARGO_PKG_VERSION");
19 println!("{}", version);
20 return Ok(())
21 }
22
23 fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
24 vec![]
25 }
26
27 fn command(&self) -> &'static str {
28 "version"
29 }
30
31 fn help(&self) -> &'static str {
32 "\t\t\t\tPrints the version"
33 }
34 }