diff options
author | 2015-11-04 01:05:19 +0100 | |
---|---|---|
committer | 2015-11-04 01:32:37 +0100 | |
commit | 820681965dce9cf7a9b529a96d0126dabf69157a (patch) | |
tree | 5e9eee2918d3ef31e5121f00d9a43595fa79b5b1 /sway/commands.c | |
parent | Merge pull request #205 from sce/focus_move_cont_to_adjacent_output (diff) | |
download | sway-820681965dce9cf7a9b529a96d0126dabf69157a.tar.gz sway-820681965dce9cf7a9b529a96d0126dabf69157a.tar.zst sway-820681965dce9cf7a9b529a96d0126dabf69157a.zip |
commands: gaps: Refactor, expected_syntax.
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 10 |
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) { | |||
760 | if ((error = checkarg(argc, "gaps", EXPECTED_AT_LEAST, 1))) { | 760 | if ((error = checkarg(argc, "gaps", EXPECTED_AT_LEAST, 1))) { |
761 | return error; | 761 | return error; |
762 | } | 762 | } |
763 | const char* expected_syntax = | ||
764 | "Expected 'gaps <inner|outer> <current|all|workspace> <set|plus|minus n>'"; | ||
763 | const char *amount_str = argv[0]; | 765 | const char *amount_str = argv[0]; |
764 | // gaps amount | 766 | // gaps amount |
765 | if (argc >= 1 && isdigit(*amount_str)) { | 767 | if (argc >= 1 && isdigit(*amount_str)) { |
@@ -793,7 +795,7 @@ static struct cmd_results *cmd_gaps(int argc, char **argv) { | |||
793 | } | 795 | } |
794 | // gaps inner|outer current|all set|plus|minus n | 796 | // gaps inner|outer current|all set|plus|minus n |
795 | if (argc < 4 || config->reading) { | 797 | if (argc < 4 || config->reading) { |
796 | return cmd_results_new(CMD_INVALID, "gaps", "Expected 'gaps <inner|outer> <current|all|workspace> <set|plus|minus n>'"); | 798 | return cmd_results_new(CMD_INVALID, "gaps", expected_syntax); |
797 | } | 799 | } |
798 | // gaps inner|outer ... | 800 | // gaps inner|outer ... |
799 | const char *inout_str = argv[0]; | 801 | const char *inout_str = argv[0]; |
@@ -803,7 +805,7 @@ static struct cmd_results *cmd_gaps(int argc, char **argv) { | |||
803 | } else if (strcasecmp(inout_str, "outer") == 0) { | 805 | } else if (strcasecmp(inout_str, "outer") == 0) { |
804 | inout = OUTER; | 806 | inout = OUTER; |
805 | } else { | 807 | } else { |
806 | return cmd_results_new(CMD_INVALID, "gaps", "Expected 'gaps <inner|outer> <current|all|workspace> <set|plus|minus n>'"); | 808 | return cmd_results_new(CMD_INVALID, "gaps", expected_syntax); |
807 | } | 809 | } |
808 | 810 | ||
809 | // gaps ... current|all ... | 811 | // gaps ... current|all ... |
@@ -821,7 +823,7 @@ static struct cmd_results *cmd_gaps(int argc, char **argv) { | |||
821 | target = WORKSPACE; | 823 | target = WORKSPACE; |
822 | } | 824 | } |
823 | } else { | 825 | } else { |
824 | return cmd_results_new(CMD_INVALID, "gaps", "Expected 'gaps <inner|outer> <current|all|workspace> <set|plus|minus n>'"); | 826 | return cmd_results_new(CMD_INVALID, "gaps", expected_syntax); |
825 | } | 827 | } |
826 | 828 | ||
827 | // gaps ... n | 829 | // gaps ... n |
@@ -843,7 +845,7 @@ static struct cmd_results *cmd_gaps(int argc, char **argv) { | |||
843 | method = ADD; | 845 | method = ADD; |
844 | amount *= -1; | 846 | amount *= -1; |
845 | } else { | 847 | } else { |
846 | return cmd_results_new(CMD_INVALID, "gaps", "Expected 'gaps <inner|outer> <current|all> <set|plus|minus n>'"); | 848 | return cmd_results_new(CMD_INVALID, "gaps", expected_syntax); |
847 | } | 849 | } |
848 | 850 | ||
849 | if (target == CURRENT) { | 851 | if (target == CURRENT) { |