Skip to content

Commit 2ea18ae

Browse files
authored
Improve help output a bit more (#205)
1 parent c77e088 commit 2ea18ae

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ $ caligula
1313
A lightweight, user-friendly disk imaging tool
1414
1515
Usage: caligula
16-
caligula burn [OPTIONS] <INPUT>
16+
caligula burn [OPTIONS] <IMAGE>
1717
caligula help [COMMAND]...
1818
1919
Options:
@@ -22,6 +22,7 @@ Options:
2222
2323
caligula burn:
2424
A lightweight, user-friendly disk imaging tool
25+
<IMAGE> Input image to burn
2526
-o <OUT> Where to write the output. If not supplied, we will search for possible disks and ask you for where you want to burn
2627
-z, --compression <COMPRESSION> What compression format the input file is in [default: ask] [possible values: ask, auto, none, gz, bz2, xz, lz4, zst]
2728
-s, --hash <HASH> The hash of the input file. For more information, see long help (--help) [default: ask]
@@ -33,7 +34,6 @@ A lightweight, user-friendly disk imaging tool
3334
--root <ROOT> If we don't have permissions on the output file, should we try to become root? [default: ask] [possible values: ask, always, never]
3435
-h, --help Print help (see more with '--help')
3536
-V, --version Print version
36-
<INPUT> Input file to burn
3737
3838
caligula help:
3939
Print this message or the help of the given subcommand(s)

src/ui/cli.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ pub enum Command {
2727
#[derive(Parser, Debug)]
2828
#[command(author, version, about, long_about = None)]
2929
pub struct BurnArgs {
30-
/// Input file to burn.
31-
#[arg(value_parser = parse_path_exists)]
32-
pub input: PathBuf,
30+
/// Input image to burn.
31+
#[arg(value_parser = parse_path_exists, display_order = 0)]
32+
pub image: PathBuf,
3333

3434
/// Where to write the output. If not supplied, we will search for possible
3535
/// disks and ask you for where you want to burn.
36-
#[arg(short)]
36+
#[arg(short, display_order = 1)] // needs display_order = 1 or else it will go above image
3737
pub out: Option<PathBuf>,
3838

3939
/// What compression format the input file is in.

src/ui/simple_ui/ask_hash.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::{
2121
pub fn ask_hash(args: &BurnArgs, cf: CompressionFormat) -> anyhow::Result<Option<FileHashInfo>> {
2222
let hash_params = match (&args.hash, &args.hash_file) {
2323
(_, Some(hash_file)) => {
24-
let Some((algs, _, expected_hash)) = find_hash_in_user_file(&args.input, hash_file)
24+
let Some((algs, _, expected_hash)) = find_hash_in_user_file(&args.image, hash_file)
2525
else {
2626
eprintln!(
2727
"Could not parse {} as a valid hash file!",
@@ -42,7 +42,7 @@ pub fn ask_hash(args: &BurnArgs, cf: CompressionFormat) -> anyhow::Result<Option
4242
}
4343
(HashArg::Skip, _) => None,
4444
(HashArg::Ask, _) => {
45-
match find_hash_in_standard_files(&args.input) {
45+
match find_hash_in_standard_files(&args.image) {
4646
Some((algs, expected_hashfile, expected_hash))
4747
if Confirm::new(&format!(
4848
"Detected hash file {expected_hashfile} in the directory. Do you want to use it?"
@@ -72,7 +72,7 @@ pub fn ask_hash(args: &BurnArgs, cf: CompressionFormat) -> anyhow::Result<Option
7272
return Ok(None);
7373
};
7474

75-
let hash_result = do_hashing(&args.input, &params)?;
75+
let hash_result = do_hashing(&args.image, &params)?;
7676

7777
if hash_result.file_hash == params.expected_hash {
7878
eprintln!("Disk image verified successfully!");

src/ui/simple_ui/ask_outfile.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ use crate::{
1313
pub fn ask_compression(args: &BurnArgs) -> anyhow::Result<CompressionFormat> {
1414
let cf = match args.compression {
1515
CompressionArg::Auto | CompressionArg::Ask => {
16-
CompressionFormat::detect_from_path(&args.input)
16+
CompressionFormat::detect_from_path(&args.image)
1717
}
1818
other => other.associated_format(),
1919
};
2020

2121
if let Some(cf) = cf {
22-
eprintln!("Input file: {}", args.input.to_string_lossy());
22+
eprintln!("Input file: {}", args.image.to_string_lossy());
2323
eprintln!("Detected compression format: {}", cf);
2424

2525
if args.force || args.compression != CompressionArg::Ask {
@@ -34,7 +34,7 @@ pub fn ask_compression(args: &BurnArgs) -> anyhow::Result<CompressionFormat> {
3434

3535
eprintln!(
3636
"Couldn't detect compression format for {}",
37-
args.input.to_string_lossy()
37+
args.image.to_string_lossy()
3838
);
3939
if args.force {
4040
eprintln!("Since --force was provided, assuming it's uncompressed!");

src/ui/simple_ui/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub fn do_setup_wizard(args: &BurnArgs) -> Result<Option<BeginParams>, anyhow::E
3434
Some(f) => WriteTarget::try_from(f.as_ref())?,
3535
None => ask_outfile(args)?,
3636
};
37-
let begin_params = BeginParams::new(args.input.clone(), compression, target)?;
37+
let begin_params = BeginParams::new(args.image.clone(), compression, target)?;
3838
if !confirm_write(args, &begin_params)? {
3939
eprintln!("Aborting.");
4040
return Ok(None);

0 commit comments

Comments
 (0)