mirror of
https://github.com/swaywm/sway.git
synced 2024-11-22 07:51:28 +00:00
swaymsg: replace if with switch in pretty_print
This commit is contained in:
parent
17ee30d070
commit
d9ce781d4c
|
@ -289,27 +289,25 @@ static void pretty_print_config(json_object *c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pretty_print(int type, json_object *resp) {
|
static void pretty_print(int type, json_object *resp) {
|
||||||
if (type != IPC_COMMAND && type != IPC_GET_WORKSPACES &&
|
switch (type) {
|
||||||
type != IPC_GET_INPUTS && type != IPC_GET_OUTPUTS &&
|
case IPC_SEND_TICK:
|
||||||
type != IPC_GET_VERSION && type != IPC_GET_SEATS &&
|
|
||||||
type != IPC_GET_CONFIG && type != IPC_SEND_TICK) {
|
|
||||||
printf("%s\n", json_object_to_json_string_ext(resp,
|
|
||||||
JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED));
|
|
||||||
return;
|
return;
|
||||||
}
|
case IPC_GET_VERSION:
|
||||||
|
|
||||||
if (type == IPC_SEND_TICK) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == IPC_GET_VERSION) {
|
|
||||||
pretty_print_version(resp);
|
pretty_print_version(resp);
|
||||||
return;
|
return;
|
||||||
}
|
case IPC_GET_CONFIG:
|
||||||
|
|
||||||
if (type == IPC_GET_CONFIG) {
|
|
||||||
pretty_print_config(resp);
|
pretty_print_config(resp);
|
||||||
return;
|
return;
|
||||||
|
case IPC_COMMAND:
|
||||||
|
case IPC_GET_WORKSPACES:
|
||||||
|
case IPC_GET_INPUTS:
|
||||||
|
case IPC_GET_OUTPUTS:
|
||||||
|
case IPC_GET_SEATS:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("%s\n", json_object_to_json_string_ext(resp,
|
||||||
|
JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
json_object *obj;
|
json_object *obj;
|
||||||
|
|
Loading…
Reference in a new issue