{"action":"created","issue":{"url":"https://api.github.com/repos/vapor-ware/synse-cli/issues/117","repository_url":"https://api.github.com/repos/vapor-ware/synse-cli","labels_url":"https://api.github.com/repos/vapor-ware/synse-cli/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/vapor-ware/synse-cli/issues/117/comments","events_url":"https://api.github.com/repos/vapor-ware/synse-cli/issues/117/events","html_url":"https://github.com/vapor-ware/synse-cli/pull/117","id":298357142,"number":117,"title":"make the format flag global, update formatting logic","user":{"login":"edaniszewski","id":1195651,"avatar_url":"https://avatars3.githubusercontent.com/u/1195651?v=4","gravatar_id":"","url":"https://api.github.com/users/edaniszewski","html_url":"https://github.com/edaniszewski","followers_url":"https://api.github.com/users/edaniszewski/followers","following_url":"https://api.github.com/users/edaniszewski/following{/other_user}","gists_url":"https://api.github.com/users/edaniszewski/gists{/gist_id}","starred_url":"https://api.github.com/users/edaniszewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edaniszewski/subscriptions","organizations_url":"https://api.github.com/users/edaniszewski/orgs","repos_url":"https://api.github.com/users/edaniszewski/repos","events_url":"https://api.github.com/users/edaniszewski/events{/privacy}","received_events_url":"https://api.github.com/users/edaniszewski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-19T17:44:19Z","updated_at":"2018-02-19T21:40:17Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/vapor-ware/synse-cli/pulls/117","html_url":"https://github.com/vapor-ware/synse-cli/pull/117","diff_url":"https://github.com/vapor-ware/synse-cli/pull/117.diff","patch_url":"https://github.com/vapor-ware/synse-cli/pull/117.patch"},"body":"fixes #113 \r\n\r\nThis PR removes the `--output` flag from the commands that specified them and replaces that functionality with a global `--format` flag. The currently supported formats are `pretty`, `yaml`, `yml`, and `json`. \r\n\r\nIn order for the `--format` flag to be global, some of the formatting logic had to be cleaned up/redone. Overall, it does feel cleaner than it was before. I think this is a good first pass, but there are areas that I think could be further improved/generalized in the future. \r\n\r\nThis gets the functionality in, but I still need to write tests against all of this as well as update the CLI help text to explicitly state the supported values for `--format`. The documenting will happen in a separate PR since there is a bunch of documenting work that needs to be done. The testing will be done in a separate PR since that is a large task and will likely include the re-write/updating of all command tests to test the actual output of the command, not just the error state.\r\n\r\n## Examples\r\ndefault (`pretty` unless the command doesn't support `pretty`, then `yaml`)\r\n```\r\n➜ ./build/synse config\r\nlocale: en_US\r\npretty_json: true\r\nlogging: debug\r\ncache:\r\n  meta:\r\n    ttl: 20\r\n  transaction:\r\n    ttl: 20\r\ngrpc:\r\n  timeout: 20\r\n```\r\n\r\n`pretty` formatting\r\n```\r\n➜ ./build/synse --format=pretty config\r\n'pretty' formatting not supported for config\r\n```\r\n\r\n`yaml` formatting\r\n```\r\n➜ ./build/synse --format=yaml config\r\nlocale: en_US\r\npretty_json: true\r\nlogging: debug\r\ncache:\r\n  meta:\r\n    ttl: 20\r\n  transaction:\r\n    ttl: 20\r\ngrpc:\r\n  timeout: 20\r\n```\r\n\r\n`yaml` formatting (via `yml`)\r\n```\r\n➜ ./build/synse --format=yml config\r\nlocale: en_US\r\npretty_json: true\r\nlogging: debug\r\ncache:\r\n  meta:\r\n    ttl: 20\r\n  transaction:\r\n    ttl: 20\r\ngrpc:\r\n  timeout: 20\r\n```\r\n\r\n`json` formatting\r\n```\r\n➜ ./build/synse --format=json config\r\n{\r\n  \"locale\": \"en_US\",\r\n  \"pretty_json\": true,\r\n  \"logging\": \"debug\",\r\n  \"cache\": {\r\n    \"meta\": {\r\n      \"ttl\": 20\r\n    },\r\n    \"transaction\": {\r\n      \"ttl\": 20\r\n    }\r\n  },\r\n  \"grpc\": {\r\n    \"timeout\": 20\r\n  }\r\n}\r\n```\r\n\r\ninvalid format\r\n```\r\n➜ ./build/synse --format=foo config\r\nfoo is an unsupported format flag. it should be one of [pretty|yaml|yml|json]\r\n```"},"comment":{"url":"https://api.github.com/repos/vapor-ware/synse-cli/issues/comments/366809059","html_url":"https://github.com/vapor-ware/synse-cli/pull/117#issuecomment-366809059","issue_url":"https://api.github.com/repos/vapor-ware/synse-cli/issues/117","id":366809059,"user":{"login":"timfallmk","id":5316117,"avatar_url":"https://avatars3.githubusercontent.com/u/5316117?v=4","gravatar_id":"","url":"https://api.github.com/users/timfallmk","html_url":"https://github.com/timfallmk","followers_url":"https://api.github.com/users/timfallmk/followers","following_url":"https://api.github.com/users/timfallmk/following{/other_user}","gists_url":"https://api.github.com/users/timfallmk/gists{/gist_id}","starred_url":"https://api.github.com/users/timfallmk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timfallmk/subscriptions","organizations_url":"https://api.github.com/users/timfallmk/orgs","repos_url":"https://api.github.com/users/timfallmk/repos","events_url":"https://api.github.com/users/timfallmk/events{/privacy}","received_events_url":"https://api.github.com/users/timfallmk/received_events","type":"User","site_admin":false},"created_at":"2018-02-19T21:40:17Z","updated_at":"2018-02-19T21:40:17Z","author_association":"CONTRIBUTOR","body":"Awesome 💯 . Love it.\r\n![](https://vignette.wikia.nocookie.net/creepypasta/images/9/9e/Dubs.gif/revision/latest?cb=20121228102855)\r\n"}}
{"actor":{"display_login":"timfallmk"}}