Skip to content

Commit e2319f1

Browse files
committed
Added crate feature to clap for better version management.
1 parent 608b6dd commit e2319f1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ description = "This tool is a machine code de-optimizer. By transforming/mutatin
1717
base64 = "0.21.6"
1818
bitflags = "2.4.1"
1919
chrono = "0.4.31"
20-
clap = { version = "4.4.7", features = ["derive"] }
20+
clap = { version = "4.4.7", features = ["derive", "cargo"] }
2121
colored = "2.0.4"
2222
ctrlc = "3.4.1"
2323
hex = "0.4.3"

src/options.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use clap::crate_version;
12
use clap::CommandFactory;
23
use clap::Parser;
34
use colored::Colorize;
@@ -7,6 +8,8 @@ use std::fs;
78
use std::process;
89
use thiserror::Error;
910

11+
const VERSION: &str = crate_version!();
12+
1013
#[derive(Error, Debug)]
1114
pub enum ArgParseError {
1215
#[error("Target file not found.")]
@@ -22,7 +25,7 @@ pub enum ArgParseError {
2225
/// QSocket toolkit options.
2326
#[derive(Parser, PartialEq, Debug)]
2427
#[command(name = "Deoptimizer")]
25-
#[command(version = "1.0.0")]
28+
#[command(version = VERSION)]
2629
#[command(about = "Machine code deoptimizer.", long_about = None)]
2730
pub struct Options {
2831
/// Target architecture (x86/arm).

0 commit comments

Comments
 (0)