Closed qknight closed 3 weeks ago
I'm a bit confused by this issue. Its not clear how the following argument:
.arg(
Arg::new("set-import")
.long("set-import")
.help("Updates DLL bindings for <from> so it points to <to>")
.num_args(3)
.value_names(["asdf"]) // FIXME is printed 3 times in --help, why?!
.required(false),
)
is supposed to produce the following help output
--set-import <file> <from> <to>
Either (or both)
@epage I don't know how I could be more clear.
All I want is that the help page reads:
(base) PS C:\Users\joschie\Desktop\Projects\fixPath\target\debug> .\fixPath.exe --help
>>> fixPath to modify FS locations of linked DLLs in an PE executable <<<
Usage: fixPath.exe <--version|--list-imports <FILENAME>|--set-import <asdf> <asdf> <asdf>>
Options:
--version Prints the version
--list-imports <file> Calls the list_imports function with a filename
--set-import <file> <from> <to> Updates <file> DLL bindings for <from> so it points to <to>
-h, --help Print help
Can you provide a reproduction example that attempts that? As I said, the reproduction case in the issue does not. asdf
has nothign to do with file
, from
, or to
I think we are done here, thanks anyway.
For those who read this issue, my solution is now:
.arg(
Arg::new("set-import")
.long("set-import")
.short('s')
.help("Updates DLL <file> bindings for <from> so it points to <to>, ./fixPath test.exe foo.dll c:\\foo.dll")
.value_name("arg")
.num_args(3)
.required(false),
)
And the help is then:
Usage: fixPath.exe <--version|--list-imports <arg>|--set-import <arg> <arg> <arg>>
Options:
--version Prints the version
-l, --list-imports <arg> Lists DLL <file> the list_imports function with a filename
-s, --set-import <arg> <arg> <arg> Updates DLL <file> bindings for <from> so it points to <to>, ./fixPath test.exe foo.dll c:\foo.dll
-h, --help Print help
Please complete the following tasks
Rust Version
1.78.0
Clap Version
4.3.24
Minimal reproducible code
issue
the --help for set-import should look like:
but instead it looks like:
It will always just repeat what i put into
or
I also tried subcommand and browsed through all the examples but I couldn't find a mention for a command line option with 3 arguments.
the --help run
replit
The code is at: https://replit.com/@qknight/test
the code
Steps to reproduce the bug with the above code
Use replit or simply copy the contents into a main.rs and use:
Actual Behaviour
It shows:
--set-import
Expected Behaviour
Should show:
--set-import
Additional Context
No response
Debug Output
No response