#![allow(unused_imports, dead_code)]
use clap::builder::{
NonEmptyStringValueParser, PossibleValue, PossibleValuesParser, TypedValueParser, ValueParser,
ValueParserFactory,
};
use clap::{Arg, ArgAction, Command};
use std::ffi::{OsStr, OsString};
use std::ops::RangeInclusive;
use std::path::PathBuf;
use std::str::FromStr;
pub(crate) mod options {
pub const HELP: &str = "help";
pub const ADDRESS_RADIX: &str = "address-radix";
pub const SKIP_BYTES: &str = "skip-bytes";
pub const READ_BYTES: &str = "read-bytes";
pub const ENDIAN: &str = "endian";
pub const STRINGS: &str = "strings";
pub const FORMAT: &str = "format";
pub const OUTPUT_DUPLICATES: &str = "output-duplicates";
pub const TRADITIONAL: &str = "traditional";
pub const WIDTH: &str = "width";
pub const FILENAME: &str = "FILENAME";
}
#[allow(unused_imports)]
use options::*;
fn format_usage(s: &str) -> String {
s.to_string()
}
pub static OD_ENV_DEFAULTS: &[crate::builtins::clap_env::EnvDefault] = &[];
pub fn od_command() -> Command {
Command::new("od")
.version(env!("CARGO_PKG_VERSION"))
.about(::std::string::String::from("Dump files in octal and other formats"))
.override_usage(
format_usage(
&::std::string::String::from(
"od [OPTION]... [--] [FILENAME]...\nod [-abcdDefFhHiIlLoOsxX] [FILENAME] [[+][0x]OFFSET[.][b]]\nod --traditional [OPTION]... [FILENAME] [[+][0x]OFFSET[.][b] [[+][0x]LABEL[.][b]]]",
),
),
)
.after_help(
::std::string::String::from(
"Displays data in various human-readable formats. If multiple formats are\nspecified, the output will contain all formats in the order they appear on the\ncommand line. Each format will be printed on a new line. Only the line\ncontaining the first format will be prefixed with the offset.",
),
)
.dont_delimit_trailing_values(true)
.infer_long_args(true)
.args_override_self(true)
.disable_help_flag(true)
.arg(
Arg::new(options::HELP)
.long(options::HELP)
.help(::std::string::String::from("Print help information."))
.action(ArgAction::Help),
)
.arg(
Arg::new(options::ADDRESS_RADIX)
.short('A')
.long(options::ADDRESS_RADIX)
.help(
::std::string::String::from(
"Select the base in which file offsets are printed.",
),
)
.value_name("RADIX"),
)
.arg(
Arg::new(options::SKIP_BYTES)
.short('j')
.long(options::SKIP_BYTES)
.help(
::std::string::String::from(
"Skip bytes input bytes before formatting and writing.",
),
)
.value_name("BYTES"),
)
.arg(
Arg::new(options::READ_BYTES)
.short('N')
.long(options::READ_BYTES)
.help(::std::string::String::from("limit dump to BYTES input bytes"))
.value_name("BYTES"),
)
.arg(
Arg::new(options::ENDIAN)
.long(options::ENDIAN)
.help(
::std::string::String::from(
"byte order to use for multi-byte formats",
),
)
.value_parser(
::clap::builder::PossibleValuesParser::new(["big", "little"]),
)
.value_name("big|little"),
)
.arg(
Arg::new(options::STRINGS)
.short('S')
.long(options::STRINGS)
.help(
::std::string::String::from(
"output strings of at least BYTES graphic chars. 3 is assumed when BYTES is not specified.",
),
)
.num_args(0..=1)
.default_missing_value("3")
.value_name("BYTES"),
)
.arg(
Arg::new("a")
.short('a')
.help(
::std::string::String::from(
"named characters, ignoring high-order bit",
),
)
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("b")
.short('b')
.help(::std::string::String::from("octal bytes"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("c")
.short('c')
.help(
::std::string::String::from("ASCII characters or backslash escapes"),
)
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("d")
.short('d')
.help(::std::string::String::from("unsigned decimal 2-byte units"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("D")
.short('D')
.help(::std::string::String::from("unsigned decimal 4-byte units"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("o")
.short('o')
.help(::std::string::String::from("octal 2-byte units"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("I")
.short('I')
.help(::std::string::String::from("decimal 8-byte units"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("L")
.short('L')
.help(::std::string::String::from("decimal 8-byte units"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("i")
.short('i')
.help(::std::string::String::from("decimal 4-byte units"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("l")
.short('l')
.help(::std::string::String::from("decimal 8-byte units"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("x")
.short('x')
.help(::std::string::String::from("hexadecimal 2-byte units"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("h")
.short('h')
.help(::std::string::String::from("hexadecimal 2-byte units"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("O")
.short('O')
.help(::std::string::String::from("octal 4-byte units"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("s")
.short('s')
.help(::std::string::String::from("decimal 2-byte units"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("X")
.short('X')
.help(::std::string::String::from("hexadecimal 4-byte units"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("H")
.short('H')
.help(::std::string::String::from("hexadecimal 4-byte units"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("e")
.short('e')
.help(
::std::string::String::from(
"floating point double precision (64-bit) units",
),
)
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("f")
.short('f')
.help(
::std::string::String::from(
"floating point single precision (32-bit) units",
),
)
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("F")
.short('F')
.help(
::std::string::String::from(
"floating point double precision (64-bit) units",
),
)
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::FORMAT)
.short('t')
.long("format")
.help(::std::string::String::from("select output format or formats"))
.action(ArgAction::Append)
.num_args(1)
.value_name("TYPE"),
)
.arg(
Arg::new(options::OUTPUT_DUPLICATES)
.short('v')
.long(options::OUTPUT_DUPLICATES)
.help(
::std::string::String::from("do not use * to mark line suppression"),
)
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::WIDTH)
.short('w')
.long(options::WIDTH)
.help(
::std::string::String::from(
"output BYTES bytes per output line. 32 is implied when BYTES is not\nspecified.",
),
)
.default_missing_value("32")
.value_name("BYTES")
.num_args(..=1),
)
.arg(
Arg::new(options::TRADITIONAL)
.long(options::TRADITIONAL)
.help(
::std::string::String::from(
"compatibility mode with one input, offset and label.",
),
)
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::FILENAME)
.hide(true)
.action(ArgAction::Append)
.value_hint(clap::ValueHint::FilePath),
)
}