mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 16:36:26 +01:00
commands: replace EXPECTED_LESS_THAN with EXPECTED_AT_MOST
This makes it a bit more obvious what the expected number of arguments is.
This commit is contained in:
parent
000d96e525
commit
9227cb7d67
5 changed files with 7 additions and 7 deletions
|
@ -40,7 +40,7 @@ struct cmd_results {
|
||||||
|
|
||||||
enum expected_args {
|
enum expected_args {
|
||||||
EXPECTED_AT_LEAST,
|
EXPECTED_AT_LEAST,
|
||||||
EXPECTED_LESS_THAN,
|
EXPECTED_AT_MOST,
|
||||||
EXPECTED_EQUAL_TO
|
EXPECTED_EQUAL_TO
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,9 @@ struct cmd_results *checkarg(int argc, const char *name, enum expected_args type
|
||||||
error_name = "at least ";
|
error_name = "at least ";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXPECTED_LESS_THAN:
|
case EXPECTED_AT_MOST:
|
||||||
if (argc >= val) {
|
if (argc > val) {
|
||||||
error_name = "less than ";
|
error_name = "at most ";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXPECTED_EQUAL_TO:
|
case EXPECTED_EQUAL_TO:
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct cmd_results *bar_cmd_hidden_state(int argc, char **argv) {
|
||||||
if ((error = checkarg(argc, "hidden_state", EXPECTED_AT_LEAST, 1))) {
|
if ((error = checkarg(argc, "hidden_state", EXPECTED_AT_LEAST, 1))) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
if ((error = checkarg(argc, "hidden_state", EXPECTED_LESS_THAN, 3))) {
|
if ((error = checkarg(argc, "hidden_state", EXPECTED_AT_MOST, 2))) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
if (config->reading && argc > 1) {
|
if (config->reading && argc > 1) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ struct cmd_results *bar_cmd_mode(int argc, char **argv) {
|
||||||
if ((error = checkarg(argc, "mode", EXPECTED_AT_LEAST, 1))) {
|
if ((error = checkarg(argc, "mode", EXPECTED_AT_LEAST, 1))) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
if ((error = checkarg(argc, "mode", EXPECTED_LESS_THAN, 3))) {
|
if ((error = checkarg(argc, "mode", EXPECTED_AT_MOST, 2))) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
if (config->reading && argc > 1) {
|
if (config->reading && argc > 1) {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
struct cmd_results *cmd_fullscreen(int argc, char **argv) {
|
struct cmd_results *cmd_fullscreen(int argc, char **argv) {
|
||||||
struct cmd_results *error = NULL;
|
struct cmd_results *error = NULL;
|
||||||
if ((error = checkarg(argc, "fullscreen", EXPECTED_LESS_THAN, 2))) {
|
if ((error = checkarg(argc, "fullscreen", EXPECTED_AT_MOST, 1))) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
struct sway_node *node = config->handler_context.node;
|
struct sway_node *node = config->handler_context.node;
|
||||||
|
|
Loading…
Reference in a new issue