aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorS. Christoffer Eliesen <christoffer@eliesen.no>2015-11-04 01:05:19 +0100
committerS. Christoffer Eliesen <christoffer@eliesen.no>2015-11-04 01:32:37 +0100
commit820681965dce9cf7a9b529a96d0126dabf69157a (patch)
tree5e9eee2918d3ef31e5121f00d9a43595fa79b5b1 /sway
parent58085226b33555d911a3ff27e456943701c9568f (diff)
commands: gaps: Refactor, expected_syntax.
Diffstat (limited to 'sway')
-rw-r--r--sway/commands.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 43166a1c..497e8eb1 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -760,6 +760,8 @@ static struct cmd_results *cmd_gaps(int argc, char **argv) {
if ((error = checkarg(argc, "gaps", EXPECTED_AT_LEAST, 1))) {
return error;
}
+ const char* expected_syntax =
+ "Expected 'gaps <inner|outer> <current|all|workspace> <set|plus|minus n>'";
const char *amount_str = argv[0];
// gaps amount
if (argc >= 1 && isdigit(*amount_str)) {
@@ -793,7 +795,7 @@ static struct cmd_results *cmd_gaps(int argc, char **argv) {
}
// gaps inner|outer current|all set|plus|minus n
if (argc < 4 || config->reading) {
- return cmd_results_new(CMD_INVALID, "gaps", "Expected 'gaps <inner|outer> <current|all|workspace> <set|plus|minus n>'");
+ return cmd_results_new(CMD_INVALID, "gaps", expected_syntax);
}
// gaps inner|outer ...
const char *inout_str = argv[0];
@@ -803,7 +805,7 @@ static struct cmd_results *cmd_gaps(int argc, char **argv) {
} else if (strcasecmp(inout_str, "outer") == 0) {
inout = OUTER;
} else {
- return cmd_results_new(CMD_INVALID, "gaps", "Expected 'gaps <inner|outer> <current|all|workspace> <set|plus|minus n>'");
+ return cmd_results_new(CMD_INVALID, "gaps", expected_syntax);
}
// gaps ... current|all ...
@@ -821,7 +823,7 @@ static struct cmd_results *cmd_gaps(int argc, char **argv) {
target = WORKSPACE;
}
} else {
- return cmd_results_new(CMD_INVALID, "gaps", "Expected 'gaps <inner|outer> <current|all|workspace> <set|plus|minus n>'");
+ return cmd_results_new(CMD_INVALID, "gaps", expected_syntax);
}
// gaps ... n
@@ -843,7 +845,7 @@ static struct cmd_results *cmd_gaps(int argc, char **argv) {
method = ADD;
amount *= -1;
} else {
- return cmd_results_new(CMD_INVALID, "gaps", "Expected 'gaps <inner|outer> <current|all> <set|plus|minus n>'");
+ return cmd_results_new(CMD_INVALID, "gaps", expected_syntax);
}
if (target == CURRENT) {