hkxc/args/
dump.rs

1//! Dump binary data in hexadecimal
2use std::path::PathBuf;
3
4/// ANSI color representation command examples.
5pub const EXAMPLES: &str = color_print::cstr!(
6    r#"<blue><bold><underline>Examples</underline></bold></blue>
7- <blue!>hkx -> hexdump -> stdout</blue!>
8  <cyan!>hkxc dump</cyan!> ./defaultmale.hkx
9
10- <blue!>hkx -> hexdump -> a file</blue!>
11  <cyan!>hkxc dump</cyan!> ./defaultmale.hkx <cyan!>-o</cyan!> hexdump.txt
12
13 - <blue!>hexdump -> hkx -> a file</blue!><yellow>(NOTE: For reverse conversion, use `-o` to specify the output path.)</yellow>
14  <cyan!>hkxc dump</cyan!> hexdump.txt <cyan!>-o</cyan!> ./defaultmale.hkx -r
15"#
16);
17
18#[derive(Debug, clap::Args)]
19#[clap(arg_required_else_help = true, after_long_help = EXAMPLES)]
20pub(crate) struct Args {
21    /// hkx file path/hexdump file path(When use `--reverse`)
22    pub input: PathBuf,
23    /// If specified, write to a file (If not specified, stdout)
24    #[clap(short, long)]
25    #[clap(long_help = "Output path to write a file.
26NOTE: Bytes cannot be written to stdout, so always use `-o` to specify the output when use `--reverse`.")]
27    pub output: Option<PathBuf>,
28
29    /// Reverse conversion from hexdump to bytes
30    #[clap(short, long)]
31    pub reverse: bool,
32}