1 /* Copyright 2013-present Facebook, Inc. 2 * Licensed under the Apache License, Version 2.0 */ 3 4 #include "watchman.h" 5 6 bool try_client_mode_command(const json_ref& cmd, bool pretty) { 7 auto client = std::make_shared<watchman_client>(); 8 bool res; 9 10 client->client_mode = true; 11 res = dispatch_command(client.get(), cmd, CMD_CLIENT); 12 13 if (!client->responses.empty()) { 14 json_dumpf( 15 client->responses.front(), 16 stdout, 17 pretty ? JSON_INDENT(4) : JSON_COMPACT); 18 printf("\n"); 19 } 20 21 return res; 22 } 23 24 /* vim:ts=2:sw=2:et: 25 */ 26