Added version command
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
6371417234
commit
ef492f6008
@ -6,6 +6,7 @@ edition = "2021"
|
||||
readme = "README.md"
|
||||
license = "BSD 2-Clause"
|
||||
authors = ["Gregory Ballantine <gballantine@bitgoblin.tech>"]
|
||||
repository = "https://git.metaunix.net/BitGoblin/zealot"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "3.2", features = ['derive'] }
|
||||
|
@ -18,3 +18,21 @@ pub fn setup_command() {
|
||||
// initialize the video repository
|
||||
r.initialize();
|
||||
}
|
||||
|
||||
pub fn version_command() {
|
||||
println!("===================================================================================");
|
||||
|
||||
// output the program and version
|
||||
println!("Zealot version v{}", env!("CARGO_PKG_VERSION"));
|
||||
|
||||
// output project description
|
||||
println!("{}", env!("CARGO_PKG_DESCRIPTION"));
|
||||
|
||||
// display license info
|
||||
println!("\nThis code is licensed under the {} license.", env!("CARGO_PKG_LICENSE"));
|
||||
|
||||
// output the project source URL
|
||||
println!("View the source code or file issues at {}.", env!("CARGO_PKG_REPOSITORY"));
|
||||
|
||||
println!("===================================================================================");
|
||||
}
|
||||
|
@ -22,8 +22,11 @@ struct Cli {
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum Commands {
|
||||
/// displays version info about this program
|
||||
// Runs the setup command
|
||||
Setup {},
|
||||
|
||||
// Displays version info about the program
|
||||
Version {},
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@ -37,6 +40,7 @@ fn main() {
|
||||
match &cli.command {
|
||||
// sub-commands will be handled here
|
||||
Some(Commands::Setup {}) => cmd::core::setup_command(),
|
||||
Some(Commands::Version {}) => cmd::core::version_command(),
|
||||
|
||||
// run the main program without any commands
|
||||
None => {
|
||||
|
Loading…
Reference in New Issue
Block a user