feat(cli): rsync short-option clustering and inline/attached values (#285)
Implement rsync 3.4.1 client-CLI parity: - cluster boolean shorts (-av, -aAX, -rlpt) and accept attached values (-B1048576, -essh, -Mfoo); add the -r, -b, -L and -B short aliases (-r is a faithful no-op since FastSync is always recursive) - stop OPT_NOOP (-s/--secluded-args, -r/--recursive) from swallowing the next argv - add inline --opt=value for every value-taking long option, including --exclude/--include/--exclude-from/--include-from/--log-file (#291) - accept --port on the server CLI in addition to -p (#296) - reject unknown flags naming the flag and stating it is unsupported Unit tests cover clustering, attached/inline values, the OPT_NOOP argument-consumption fix and rejected shorts.
This commit is contained in:
+13
-7
@@ -192,14 +192,20 @@ int server_cli_parse(int argc, char* argv[], ServerCliOptions* opts, char* err,
|
||||
inline_value = argv[++i];
|
||||
}
|
||||
opts->iconv_spec = inline_value;
|
||||
} else if (arg_is(argv[i], "-p")) {
|
||||
if (i + 1 >= argc) {
|
||||
set_error(err, err_size, "missing argument for -p");
|
||||
return -1;
|
||||
} else if (arg_is(argv[i], "-p") || arg_has_value(argv[i], "--port", &inline_value)) {
|
||||
if (inline_value) {
|
||||
opts->port_set = true;
|
||||
if (parse_port_arg(inline_value, &opts->port, err, err_size) != 0)
|
||||
return -1;
|
||||
} else {
|
||||
if (i + 1 >= argc) {
|
||||
set_error(err, err_size, "missing argument for %s", argv[i]);
|
||||
return -1;
|
||||
}
|
||||
opts->port_set = true;
|
||||
if (parse_port_arg(argv[++i], &opts->port, err, err_size) != 0)
|
||||
return -1;
|
||||
}
|
||||
opts->port_set = true;
|
||||
if (parse_port_arg(argv[++i], &opts->port, err, err_size) != 0)
|
||||
return -1;
|
||||
} else {
|
||||
if (arg_has_value(argv[i], "--config", &inline_value)) {
|
||||
if (!inline_value) {
|
||||
|
||||
Reference in New Issue
Block a user