{"action":"created","issue":{"url":"https://api.github.com/repos/coreos/etcd/issues/2892","labels_url":"https://api.github.com/repos/coreos/etcd/issues/2892/labels{/name}","comments_url":"https://api.github.com/repos/coreos/etcd/issues/2892/comments","events_url":"https://api.github.com/repos/coreos/etcd/issues/2892/events","html_url":"https://github.com/coreos/etcd/pull/2892","id":82909054,"number":2892,"title":"WIP: DO NOT MERGE: Bash completions for etcdctl","user":{"login":"eparis","id":8093535,"avatar_url":"https://avatars.githubusercontent.com/u/8093535?v=3","gravatar_id":"","url":"https://api.github.com/users/eparis","html_url":"https://github.com/eparis","followers_url":"https://api.github.com/users/eparis/followers","following_url":"https://api.github.com/users/eparis/following{/other_user}","gists_url":"https://api.github.com/users/eparis/gists{/gist_id}","starred_url":"https://api.github.com/users/eparis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eparis/subscriptions","organizations_url":"https://api.github.com/users/eparis/orgs","repos_url":"https://api.github.com/users/eparis/repos","events_url":"https://api.github.com/users/eparis/events{/privacy}","received_events_url":"https://api.github.com/users/eparis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-05-30T20:46:07Z","updated_at":"2015-06-01T18:01:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/coreos/etcd/pulls/2892","html_url":"https://github.com/coreos/etcd/pull/2892","diff_url":"https://github.com/coreos/etcd/pull/2892.diff","patch_url":"https://github.com/coreos/etcd/pull/2892.patch"},"body":"This does 2 things.  First is ports from codegansta/cli to spf13/cobra.\r\n\r\nSecond it uses spf13/cobra to generate intelligent bash completions for etcdctl.  The are generated by running\r\n\r\n`etcdctl genbash --outfile=yourfile` and then sourcing the file `. yourfile` (or you could put the output in `/etc/bash_completion.d/` or `/usr/share/bash-completion/completions/` and have it automatically loaded.)\r\n\r\nThese completions are pretty cool because on my machine you can do obvious simple things:\r\n\r\n```\r\n# etcdctl [tab][tab]\r\nbackup          exec-watch      get             import          member          mkdir           rmdir           setdir          updatedir       \r\ncluster-health  genbash         help            ls              mk              rm              set             update          watch\r\n\r\n# etcdctl member [tab][tab]\r\nadd     list    remove  \r\n\r\n```\r\n\r\nBut it also will show you data on 127.0.0.1!\r\n\r\n```\r\n# etcdctl ls /[tab][tab]\r\n/coreos.com  /kube.local  /registry\r\n```\r\n\r\n```\r\n# etcdctl ls /r[tab][tab]\r\n\r\ncompletes\r\n\r\n# etcdctl ls /registry/\r\n/registry/controllers      /registry/minions          /registry/pods             /registry/serviceaccounts  \r\n/registry/events           /registry/namespaces       /registry/ranges           /registry/services\r\n```\r\n\r\nIt is NOT smart enough to use things you already types on your command line, so --peers etc aren't used trying to show the completions.  Only loopback."},"comment":{"url":"https://api.github.com/repos/coreos/etcd/issues/comments/107655862","html_url":"https://github.com/coreos/etcd/pull/2892#issuecomment-107655862","issue_url":"https://api.github.com/repos/coreos/etcd/issues/2892","id":107655862,"user":{"login":"xiang90","id":4479947,"avatar_url":"https://avatars.githubusercontent.com/u/4479947?v=3","gravatar_id":"","url":"https://api.github.com/users/xiang90","html_url":"https://github.com/xiang90","followers_url":"https://api.github.com/users/xiang90/followers","following_url":"https://api.github.com/users/xiang90/following{/other_user}","gists_url":"https://api.github.com/users/xiang90/gists{/gist_id}","starred_url":"https://api.github.com/users/xiang90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiang90/subscriptions","organizations_url":"https://api.github.com/users/xiang90/orgs","repos_url":"https://api.github.com/users/xiang90/repos","events_url":"https://api.github.com/users/xiang90/events{/privacy}","received_events_url":"https://api.github.com/users/xiang90/received_events","type":"User","site_admin":false},"created_at":"2015-06-01T18:01:39Z","updated_at":"2015-06-01T18:01:39Z","body":"@eparis My argument is short and long behavior differently...\r\n\r\nLook this, I have a flag (data, d). The app simply prints out the flag.\r\n\r\n```\r\n./myapp --dataddd\r\nError: unknown flag: --dataddd\r\nRun 'myapp help' for usage.\r\n```\r\n\r\n```\r\n./myapp -dataddd\r\nataddd\r\n```"}}