{"action":"created","issue":{"url":"https://api.github.com/repos/codegangsta/cli/issues/301","labels_url":"https://api.github.com/repos/codegangsta/cli/issues/301/labels{/name}","comments_url":"https://api.github.com/repos/codegangsta/cli/issues/301/comments","events_url":"https://api.github.com/repos/codegangsta/cli/issues/301/events","html_url":"https://github.com/codegangsta/cli/issues/301","id":117927592,"number":301,"title":"Add ability to get global and command level variables from a yaml file?","user":{"login":"ChrisPRobinson","id":4304218,"avatar_url":"https://avatars.githubusercontent.com/u/4304218?v=3","gravatar_id":"","url":"https://api.github.com/users/ChrisPRobinson","html_url":"https://github.com/ChrisPRobinson","followers_url":"https://api.github.com/users/ChrisPRobinson/followers","following_url":"https://api.github.com/users/ChrisPRobinson/following{/other_user}","gists_url":"https://api.github.com/users/ChrisPRobinson/gists{/gist_id}","starred_url":"https://api.github.com/users/ChrisPRobinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChrisPRobinson/subscriptions","organizations_url":"https://api.github.com/users/ChrisPRobinson/orgs","repos_url":"https://api.github.com/users/ChrisPRobinson/repos","events_url":"https://api.github.com/users/ChrisPRobinson/events{/privacy}","received_events_url":"https://api.github.com/users/ChrisPRobinson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-11-19T22:54:32Z","updated_at":"2015-12-06T19:07:45Z","closed_at":null,"body":"I worked on a tool that leverages codegangsta cli library. As part of that work I wrapped much the cli to add the capability to get values from a yaml files. One for the global parameters one for the command parameters.\r\n\r\nBy default there would be a global file called .test.config.yml that global parameters could be pulled from. The name of the file could be configurable.\r\n\r\nThe precedence would be if a value was specified on the command line it had the highest precedence, followed by and env variable, followed by a value in the yaml file.\r\n\r\nBelow is a pseudo design as I'm just trying to get across the idea.\r\n\r\nFor a command, add fields: \r\ncli.Command   \r\n   AllowFileInput string // allows the command to accept input from a file\r\n   FileInputFlagName string  // defaults to \"load\"\r\n\r\nFor Flag we can add to the the following fields\r\n   AllowFileInput // indicates that this flag value can be found in the file. \r\n\r\nThe files I pulled from were from a yaml file\r\n\r\nWe also have a version flag built into the file as well and when the file is loaded if the file doesn't meet a particular version it will error.\r\n\r\nThere are a couple of problems where I can see this getting a little complicated like pulling generic values, it could be a tricky to map, I didn't support this as we didn't need anything like that. I suppose on a first stab we can exclude pull parameters like that.\r\n\r\nWould this be an interesting capability for me to create a pull request along those lines? It would take a little time as I'd need to rework what I have to the internal code and rework the tests of course. Just trying to give to something I've used."},"comment":{"url":"https://api.github.com/repos/codegangsta/cli/issues/comments/162337460","html_url":"https://github.com/codegangsta/cli/issues/301#issuecomment-162337460","issue_url":"https://api.github.com/repos/codegangsta/cli/issues/301","id":162337460,"user":{"login":"ChrisPRobinson","id":4304218,"avatar_url":"https://avatars.githubusercontent.com/u/4304218?v=3","gravatar_id":"","url":"https://api.github.com/users/ChrisPRobinson","html_url":"https://github.com/ChrisPRobinson","followers_url":"https://api.github.com/users/ChrisPRobinson/followers","following_url":"https://api.github.com/users/ChrisPRobinson/following{/other_user}","gists_url":"https://api.github.com/users/ChrisPRobinson/gists{/gist_id}","starred_url":"https://api.github.com/users/ChrisPRobinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChrisPRobinson/subscriptions","organizations_url":"https://api.github.com/users/ChrisPRobinson/orgs","repos_url":"https://api.github.com/users/ChrisPRobinson/repos","events_url":"https://api.github.com/users/ChrisPRobinson/events{/privacy}","received_events_url":"https://api.github.com/users/ChrisPRobinson/received_events","type":"User","site_admin":false},"created_at":"2015-12-06T19:07:45Z","updated_at":"2015-12-06T19:07:45Z","body":"Another Prototype impl, tried to reduce the set of changes to core files- https://github.com/ChrisPRobinson/cli/pull/2/files"}}