mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Revert marking password as required in JOpt parser
This is a partial reversion of the earlier commit. Marking the password option as required at the parser level made it impossible to run ./bisq-cli without options or arguments and get the help text. This is a useful thing to do, and not worth creating a bad user experience to get the free required option error handling and error messaging.
This commit is contained in:
parent
a6a8702084
commit
312ef30b70
@ -75,8 +75,7 @@ public class CliMain {
|
||||
.defaultsTo(9998);
|
||||
|
||||
var passwordOpt = parser.accepts("password", "rpc server password")
|
||||
.withRequiredArg()
|
||||
.required();
|
||||
.withRequiredArg();
|
||||
|
||||
OptionSet options = null;
|
||||
try {
|
||||
@ -111,6 +110,10 @@ public class CliMain {
|
||||
var host = options.valueOf(hostOpt);
|
||||
var port = options.valueOf(portOpt);
|
||||
var password = options.valueOf(passwordOpt);
|
||||
if (password == null) {
|
||||
err.println("Error: missing required 'password' option");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
var credentials = new PasswordCallCredentials(password);
|
||||
|
||||
|
26
cli/test.sh
26
cli/test.sh
@ -52,8 +52,8 @@ echo "========================================================================"
|
||||
OUTPUT=$(expect -c '
|
||||
# exp_internal 1
|
||||
puts "TEST missing required password option error"
|
||||
set expected "Error: Missing required option(s) \\\[password\\\]"
|
||||
spawn ./bisq-cli anymethod
|
||||
set expected "Error: missing required '\''password'\'' option"
|
||||
spawn ./bisq-cli getversion
|
||||
expect {
|
||||
$expected { puts "PASS" }
|
||||
default {
|
||||
@ -133,8 +133,24 @@ OUTPUT=$(expect -c '
|
||||
}
|
||||
')
|
||||
echo "$OUTPUT"
|
||||
|
||||
echo "========================================================================"
|
||||
|
||||
echo "TEST help (todo)"
|
||||
./bisq-cli --password=xyz --help
|
||||
OUTPUT=$(expect -c '
|
||||
puts "TEST running with no options or arguments prints help text"
|
||||
# exp_internal 1
|
||||
set expected "Bisq RPC Client"
|
||||
spawn ./bisq-cli
|
||||
expect {
|
||||
$expected { puts "PASS" }
|
||||
default {
|
||||
set results $expect_out(buffer)
|
||||
puts "FAIL expected = $expected"
|
||||
puts " actual = $results"
|
||||
}
|
||||
}
|
||||
')
|
||||
echo "$OUTPUT"
|
||||
echo "========================================================================"
|
||||
|
||||
echo "TEST --help option prints help text"
|
||||
./bisq-cli --help
|
||||
|
Loading…
Reference in New Issue
Block a user