diff options
author | Ian Fan <ianfan0@gmail.com> | 2018-10-23 10:40:03 +0100 |
---|---|---|
committer | Ian Fan <ianfan0@gmail.com> | 2018-10-23 10:51:54 +0100 |
commit | 9227cb7d673b012a0c6730800d528f9d729972b6 (patch) | |
tree | 32f4a9782328486f529c09fe2bb8092c25b9993d | |
parent | 000d96e52539fd6b8ecf6f6d0d399a1bedbbb9d9 (diff) |
commands: replace EXPECTED_LESS_THAN with EXPECTED_AT_MOST
This makes it a bit more obvious what the expected number of arguments is.
-rw-r--r-- | include/sway/commands.h | 2 | ||||
-rw-r--r-- | sway/commands.c | 6 | ||||
-rw-r--r-- | sway/commands/bar/hidden_state.c | 2 | ||||
-rw-r--r-- | sway/commands/bar/mode.c | 2 | ||||
-rw-r--r-- | sway/commands/fullscreen.c | 2 |
5 files changed, 7 insertions, 7 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h index 791b37dc..6606775a 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h @@ -40,7 +40,7 @@ struct cmd_results { enum expected_args { EXPECTED_AT_LEAST, - EXPECTED_LESS_THAN, + EXPECTED_AT_MOST, EXPECTED_EQUAL_TO }; diff --git a/sway/commands.c b/sway/commands.c index 6a5eb3dd..37c7169a 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -25,9 +25,9 @@ struct cmd_results *checkarg(int argc, const char *name, enum expected_args type error_name = "at least "; } break; - case EXPECTED_LESS_THAN: - if (argc >= val) { - error_name = "less than "; + case EXPECTED_AT_MOST: + if (argc > val) { + error_name = "at most "; } break; case EXPECTED_EQUAL_TO: diff --git a/sway/commands/bar/hidden_state.c b/sway/commands/bar/hidden_state.c index 28adf6c7..5be6c2dc 100644 --- a/sway/commands/bar/hidden_state.c +++ b/sway/commands/bar/hidden_state.c @@ -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))) { return error; } - if ((error = checkarg(argc, "hidden_state", EXPECTED_LESS_THAN, 3))) { + if ((error = checkarg(argc, "hidden_state", EXPECTED_AT_MOST, 2))) { return error; } if (config->reading && argc > 1) { diff --git a/sway/commands/bar/mode.c b/sway/commands/bar/mode.c index dbdd3897..2cba785e 100644 --- a/sway/commands/bar/mode.c +++ b/sway/commands/bar/mode.c @@ -41,7 +41,7 @@ struct cmd_results *bar_cmd_mode(int argc, char **argv) { if ((error = checkarg(argc, "mode", EXPECTED_AT_LEAST, 1))) { return error; } - if ((error = checkarg(argc, "mode", EXPECTED_LESS_THAN, 3))) { + if ((error = checkarg(argc, "mode", EXPECTED_AT_MOST, 2))) { return error; } if (config->reading && argc > 1) { diff --git a/sway/commands/fullscreen.c b/sway/commands/fullscreen.c index 22d747b9..0204a73c 100644 --- a/sway/commands/fullscreen.c +++ b/sway/commands/fullscreen.c @@ -9,7 +9,7 @@ struct cmd_results *cmd_fullscreen(int argc, char **argv) { 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; } struct sway_node *node = config->handler_context.node; |