Skip to content

Commit

Permalink
Added crate feature to clap for better version management.
Browse files Browse the repository at this point in the history
  • Loading branch information
EgeBalci committed Jun 19, 2024
1 parent 608b6dd commit e2319f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ description = "This tool is a machine code de-optimizer. By transforming/mutatin
base64 = "0.21.6"
bitflags = "2.4.1"
chrono = "0.4.31"
clap = { version = "4.4.7", features = ["derive"] }
clap = { version = "4.4.7", features = ["derive", "cargo"] }
colored = "2.0.4"
ctrlc = "3.4.1"
hex = "0.4.3"
Expand Down
5 changes: 4 additions & 1 deletion src/options.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use clap::crate_version;
use clap::CommandFactory;
use clap::Parser;
use colored::Colorize;
Expand All @@ -7,6 +8,8 @@ use std::fs;
use std::process;
use thiserror::Error;

const VERSION: &str = crate_version!();

#[derive(Error, Debug)]
pub enum ArgParseError {
#[error("Target file not found.")]
Expand All @@ -22,7 +25,7 @@ pub enum ArgParseError {
/// QSocket toolkit options.
#[derive(Parser, PartialEq, Debug)]
#[command(name = "Deoptimizer")]
#[command(version = "1.0.0")]
#[command(version = VERSION)]
#[command(about = "Machine code deoptimizer.", long_about = None)]
pub struct Options {
/// Target architecture (x86/arm).
Expand Down

0 comments on commit e2319f1

Please sign in to comment.