{"thread":{"id":"2219","subject":"Re: latest stg/git commandline completions code","startedAt":"2005-10-25T14:42:45Z","lastAt":"2005-11-16T03:35:42Z","messageCount":14,"participants":["Blaisorblade","Catalin Marinas","Ben Clifford","Petr Baudis"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"10581","messageId":"200510251642.46169.blaisorblade@yahoo.it","threadId":"2219","inReplyTo":"Pine.LNX.4.60.0510251222510.8565@mundungus.clifford.ac","subject":"Re: latest stg/git commandline completions code","fromName":"Blaisorblade","fromEmail":"blaisorblade@yahoo.it","sentAt":"2005-10-25T14:42:45Z","receivedAt":"2005-10-25T14:42:45Z","isPatch":false,"sender":{"key":"blaisorblade@yahoo.it","avatar":null},"body":"On Tuesday 25 October 2005 14:24, Ben Clifford wrote:\n> hi. I'm interested in playing with the stg/git commandline completion code\n> - are you still actively working on it?\nWell, yes, I've been still tuning it - but actually I'm not _maintaining_ it, \nI'm using stgit on the Linux kernel so when on a command I don't have tab \ncompletion I add the needed one (having the time and feeling to do it).\n\nHowever, it's still done with enough care and polish to be shippable.\n\n> if so, do you have any more \n> formalised distribution process (like a git repo!) rather than grabbing\n> code out of email list postings? I can't seem to find much on google...\nWell, Catalin's TODO included \"bash completions\", so I assume the thing could \nbe merged by him. Anyway,\n\nI'm attaching the current version.\n\nBtw, it's under GPL v2.\n-- \nInform me of my mistakes, so I can keep imitating Homer Simpson's \"Doh!\".\nPaolo Giarrusso, aka Blaisorblade (Skype ID \"PaoloGiarrusso\", ICQ 215621894)\nhttp://www.user-mode-linux.org/~blaisorblade\n\n\n#Stacked git bash completion.\n\n#TODO:\n# My opinion about bash completion is that they're excessively slow, especially\n# when the system is under load.\n#\n# So:\n# - save the list of stg commands in a file, created at install moment; on an\n# idle Athlon 64 laptop at 800MHz, stg help takes 0.22 seconds of CPU time,\n# without disk I/O.\n#\n# - read .git/patches/$branch/{applied,unapplied} directly instead of invoking\n# stg.\n#\n\n#XXX: must test for bash version, done in generic bash-completion and the\n#generic value can be seen from here, if we are included by the loop at the end\n#of /etc/bash_completion, i.e. if we're installed in /etc/bash-completion.d.\n#\n#Gentoo should be fixed to allow this.\n\nbashdefault=\"-o bashdefault\"\ndefault=\"-o default\"\n\n#XXX: not StGit specific, valid for git too.\n__git_refs()\n{\n    for i in $(echo .git/refs/heads/*); do\n\techo ${i#.git/refs/heads/}\n    done\n    for i in $(echo .git/refs/tags/*); do\n\techo ${i#.git/refs/tags/}\n    done\n    echo HEAD\n}\n\n__stg_unapplied()\n{\n    stg unapplied 2>/dev/null $@\n}\n\n__stg_applied()\n{\n    stg applied 2>/dev/null $@\n}\n\n__stg_all_patches()\n{\n    __stg_applied $@; __stg_unapplied $@\n}\n\n#XXX: Find a better name for this.\n#\n__stg_all_patch_ranges()\n{\n    __stg_all_patches $@|while read i; do echo $i/; done\n}\n\n__stg_top()\n{\n    stg top 2>/dev/null $@\n}\n\n__stg_branches()\n{\n    #for i in $(compgen -f .git/patches/); do\n    for i in $(echo .git/patches/*); do\n\techo ${i#.git/patches/}\n    done\n}\n\n_stg_range()\n{\n    #Ugly - should return the result rather than set COMPREPLY.\n    local cur=$1 patches=$2\n    if [ \"${cur#*:}\" != \"${cur}\" ]; then\n\t# Complete the 2nd range component, after ':'.\n\tCOMPREPLY=( $(compgen -W \"${patches}\" -- ${cur#*:}) )\n    else\n\tCOMPREPLY=( $(compgen -W \"${patches}\" -- $cur) )\n    fi\n}\n\n_stg ()\n{\n    local cur cmd cmds opts\n    cur=${COMP_WORDS[COMP_CWORD]}\n    COMPREPLY=()\n    if [ $COMP_CWORD -eq 1 ]; then\n\tcmds=$(stg help|tail +4|awk '{print $1}')\n\tCOMPREPLY=( $(compgen -W \"${cmds}\" -- $cur) )\n    else\n\tlocal cmd=${COMP_WORDS[1]}\n\tlocal prev=${COMP_WORDS[COMP_CWORD-1]}\n\tlocal o_help=\"-h --help\"\n\tlocal o_branch=\"-b --branch\"\n\t#XXX: Add -b support - pass \"-b branch\" to unapplied and applied.\n\t#This can be done by calling __stg_unapplied directly below\n\t#instead of setting patches here.\n\t#But: how to look for -b? I'm scared about looping over opts\n\t#(I don't like completions when they take so much time).\n\tcase $cmd in\n\t    push)\n\t    if [ \"$prev\" = \"-t\" -o \"$prev\" = \"--to\" ]; then\n\t\t_stg_range \"$cur\" \"$(__stg_unapplied)\"\n#\t\tif [ \"${cur#*:}\" != \"${cur}\" ]; then\n#\t\t    COMPREPLY=( $(compgen -W \"$(__stg_unapplied)\" -- ${cur#*:}) )\n#\t\telse\n#\t\t    COMPREPLY=( $(compgen -W \"$(__stg_unapplied)\" -- $cur) )\n#\t\tfi\n\t    else\n\t\topts=\"-a --all -n --number -t --to --reverse --undo $o_help\"\n\t\tCOMPREPLY=( $(compgen -W \"${opts} $(__stg_unapplied)\" -- $cur) )\n\t    fi\n\t    ;;\n\n\t    pop)\n\t    if [ \"$prev\" = \"-t\" -o \"$prev\" = \"--to\" ]; then\n\t\tCOMPREPLY=( $(compgen -W \"$(__stg_applied)\" -- $cur) )\n\t    else\n\t\topts=\"-a --all -n --number -t --to $o_help\"\n\t\tCOMPREPLY=( $(compgen -W \"${opts}\" -- $cur) )\n\t    fi\n\t    ;;\n\n\t    export)\n\t    if [ \"$prev\" = \"-r\" -o \"$prev\" = \"--range\" ]; then\n\t\t_stg_range \"$cur\" \"$(__stg_applied)\"\n\t    else\n\t\topts=\"-n --numbered -d --diff -t --template -r --range \\\n\t\t$o_branch $o_help\"\n\n\t\tCOMPREPLY=( $(compgen $default -W \"${opts}\" -- $cur) )\n\t    fi\n\t    ;;\n\t    mail)\n\t    if [ \"$prev\" = \"-r\" -o \"$prev\" = \"--range\" ]; then\n\t\t_stg_range \"$cur\" \"$(__stg_applied)\"\n#\t\tif [ \"${cur#*:}\" != \"${cur}\" ]; then\n#\t\t    COMPREPLY=( $(compgen -W \"$(__stg_applied)\" -- ${cur#*:}) )\n#\t\telse\n#\t\t    COMPREPLY=( $(compgen -W \"$(__stg_applied)\" -- $cur) )\n#\t\tfi\n\t    else\n\t\topts=\"-a --all -r --range --to --cc --bcc -v --version \\\n\t\t-t --template -f --first -s --sleep --refid -u --smtp-user \\\n\t\t-p --smtp-password $o_branch $o_help\"\n\n\t\tCOMPREPLY=( $(compgen $bashdefault -W \"${opts} \\\n\t\t$(__stg_applied)\" -- $cur) )\n\t    fi\n\t    ;;\n\t    diff)\n\t    if [ \"$prev\" = \"-r\" ]; then\n\t\tif [ \"${cur#*:}\" != \"${cur}\" ]; then\n\t\t    COMPREPLY=( $(compgen -W \"$(__stg_all_patch_ranges)\" -- \\\n\t\t    ${cur#*:}) )\n\t\telse\n\t\t    COMPREPLY=( $(compgen -W \"$(__stg_all_patch_ranges)\" -- \\\n\t\t    $cur) )\n\t\tfi\n\t    else\n\t\topts=\"-r -s --stat $o_help\"\n\n\t\tCOMPREPLY=( $(compgen -W \"${opts}\" -- $cur) )\n\t    fi\n\t    ;;\n\t    id)\n\t    if [ \"$prev\" = \"-b\" -o \"$prev\" = \"--branch\" ]; then\n\t\tCOMPREPLY=( $(compgen -W \"$(__stg_branches)\" -- $cur) )\n\t    else\n\t\topts=\"$o_branch $o_help\"\n\t\t#there's a lot of possible id's to complete\n\t\tCOMPREPLY=( $(compgen -W \"${opts} $(__stg_all_patch_ranges) \\\n\t\t$(__git_refs)\" -- $cur) )\n\t    fi\n\t    ;;\n\t    rename)\n\t    if [ \"$prev\" = \"-b\" -o \"$prev\" = \"--branch\" ]; then\n\t\tCOMPREPLY=( $(compgen -W \"$(__stg_branches)\" -- $cur) )\n\t    else\n\t\tCOMPREPLY=( $(compgen -W \"$(__stg_all_patches)\" -- $cur) )\n\t    fi\n\t    ;;\n\t    delete)\n\t    opts=\"${o_help}\"\n\t    COMPREPLY=( $(compgen -W \"${opts} $(__stg_unapplied; __stg_top)\" \\\n\t    -- $cur) )\n\t    ;;\n\t    series|unapplied|applied)\n\t    if [ \"$prev\" = \"-b\" -o \"$prev\" = \"--branch\" ]; then\n\t\tCOMPREPLY=( $(compgen -W \"$(__stg_branches)\" -- $cur) )\n\t    else\n\t\topts=\"$o_branch $o_help\"\n\t\t[ \"$cmd\" = \"series\" ] && \\\n\t\t    opts=\"$opts -e --empty\"\n\t\tCOMPREPLY=( $(compgen -W \"${opts}\" -- $cur) )\n\t    fi\n\t    ;;\n\t    refresh)\n\t    opts=\"-f --force -e --edit -s --showpatch -m --message \\\n\t    -a --author --authname --authemail --authdate --commname\n\t    --commemail $o_help\"\n\n\t    COMPREPLY=( $(compgen $bashdefault -W \"${opts}\" -- $cur) )\n\t    ;;\n\t    *)\n\t    COMPREPLY=( $(compgen $bashdefault -W \"${o_help}\" -f -- $cur) )\n\t    ;;\n\tesac\n    fi\n}\n\ncomplete $default -F _stg stg\n\n# vi: set ft=sh sw=4:\n"},{"id":"10582","messageId":"tnxwtk1lj58.fsf@arm.com","threadId":"2219","inReplyTo":"200510251642.46169.blaisorblade@yahoo.it","subject":"Re: latest stg/git commandline completions code","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2005-10-25T15:18:43Z","receivedAt":"2005-10-25T15:18:43Z","isPatch":false,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"Blaisorblade <blaisorblade@yahoo.it> wrote:\n> I'm using stgit on the Linux kernel so when on a command I don't have tab \n> completion I add the needed one (having the time and feeling to do\n> it).\n\nYou can have a look at the tlacontrib project scripts (I can forward\nthem to you since you would need tla/baz to clone/checkout the project\nand this procedure is a combination of 'tag' and 'get' commands). They\nautomatically generate the commands together with the options and are\nlater used in completion.\n\nOf course, your approach would work as well but it requires more\nmaintance.\n\n>> if so, do you have any more formalised distribution process (like a\n>> git repo!) rather than grabbing code out of email list postings? I\n>> can't seem to find much on google...\n>\n> Well, Catalin's TODO included \"bash completions\", so I assume the\n> thing could be merged by him. Anyway, I'm attaching the current\n> version.\n\nWhen you think it is ready, I'm happy to include it (though I would\nprefer a more dynamic approach like the tla one but since I don't have\ntime for it I'll just use yours).\n\nThanks.\n\n-- \nCatalin\n"},{"id":"10585","messageId":"200510251753.20164.blaisorblade@yahoo.it","threadId":"2219","inReplyTo":"tnxwtk1lj58.fsf@arm.com","subject":"Re: latest stg/git commandline completions code","fromName":"Blaisorblade","fromEmail":"blaisorblade@yahoo.it","sentAt":"2005-10-25T15:53:19Z","receivedAt":"2005-10-25T15:53:19Z","isPatch":false,"sender":{"key":"blaisorblade@yahoo.it","avatar":null},"body":"On Tuesday 25 October 2005 17:18, Catalin Marinas wrote:\n> Blaisorblade <blaisorblade@yahoo.it> wrote:\n> > I'm using stgit on the Linux kernel so when on a command I don't have tab\n> > completion I add the needed one (having the time and feeling to do\n> > it).\n\n> You can have a look at the tlacontrib project scripts (I can forward\n> them to you since you would need tla/baz to clone/checkout the project\n> and this procedure is a combination of 'tag' and 'get' commands). They\n> automatically generate the commands together with the options and are\n> later used in completion.\n\n> Of course, your approach would work as well but it requires more\n> maintance.\n\n_Yes_, it wasn't ever intended to be published, and the help output doesn't \nseem, at a quick look, trivially parsable (the source is better to parse but \nI refuse that. Also, some options require still a special handling.\n\nThe best idea seems to write a Python script sourcing the Stgit source \n(stgit/main.py to get commands, and then loading each class and iterating \nover the \"options\" module member). I'm not fluent in Python enough currently, \nbut when I'll find time I'll probably study a bit reflection and write this \ndown (my Python experience amounts to some random readings on reviews and a \ncouple of days with Python docs).\n\n> >> if so, do you have any more formalised distribution process (like a\n> >> git repo!) rather than grabbing code out of email list postings? I\n> >> can't seem to find much on google...\n\n> > Well, Catalin's TODO included \"bash completions\", so I assume the\n> > thing could be merged by him. Anyway, I'm attaching the current\n> > version.\n\n> When you think it is ready, I'm happy to include it (though I would\n> prefer a more dynamic approach like the tla one but since I don't have\n> time for it I'll just use yours).\n\nBtw, what do you think about speeding up completions by reimplementing things \nlike \"stg applied\" or \"stg unapplied\" via cat (as noted in the comments at \nthe beginning of the script)? Tab completions can easily livelock a shell on \na busy system, so it's worthy speeding the thing up.\n\n> Thanks.\n\n-- \nInform me of my mistakes, so I can keep imitating Homer Simpson's \"Doh!\".\nPaolo Giarrusso, aka Blaisorblade (Skype ID \"PaoloGiarrusso\", ICQ 215621894)\nhttp://www.user-mode-linux.org/~blaisorblade\n\n\t\n\n\t\n\t\t\n___________________________________ \nYahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB \nhttp://mail.yahoo.it\n"},{"id":"10587","messageId":"b0943d9e0510250924g3f5d9281r@mail.gmail.com","threadId":"2219","inReplyTo":"200510251753.20164.blaisorblade@yahoo.it","subject":"Re: latest stg/git commandline completions code","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2005-10-25T16:24:28Z","receivedAt":"2005-10-25T16:24:28Z","isPatch":false,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 25/10/05, Blaisorblade <blaisorblade@yahoo.it> wrote:\n> The best idea seems to write a Python script sourcing the Stgit source\n> (stgit/main.py to get commands, and then loading each class and iterating\n> over the \"options\" module member).\n\nI can add a function in stgit/main.py which would list the options.\nThe tla-completion generates a file listing a command with its option\non every line:\n\n  push -a -all -n --number -t --to --reverse --undo -h --help\n  ...\n\nSince I don't know much about the bash completion, let me know of the\nformat you'd prefer.\n\n> Btw, what do you think about speeding up completions by reimplementing things\n> like \"stg applied\" or \"stg unapplied\" via cat (as noted in the comments at\n> the beginning of the script)? Tab completions can easily livelock a shell on\n> a busy system, so it's worthy speeding the thing up.\n\nIn general, it is better to use the stg commands but the repository\nstructure won't probably change for a long time and it's OK to\noptimise (if the speed improvement is visible). Anyway, these\nparticular commands are pretty fast (they behave like cat) but there\nare others which are slower (usually the commands involving calls to\nthe GIT tool).\n\n--\nCatalin\n"},{"id":"10590","messageId":"200510251905.27768.blaisorblade@yahoo.it","threadId":"2219","inReplyTo":"b0943d9e0510250924g3f5d9281r@mail.gmail.com","subject":"Re: latest stg/git commandline completions code","fromName":"Blaisorblade","fromEmail":"blaisorblade@yahoo.it","sentAt":"2005-10-25T17:05:26Z","receivedAt":"2005-10-25T17:05:26Z","isPatch":false,"sender":{"key":"blaisorblade@yahoo.it","avatar":null},"body":"On Tuesday 25 October 2005 18:24, Catalin Marinas wrote:\n> On 25/10/05, Blaisorblade <blaisorblade@yahoo.it> wrote:\n> > The best idea seems to write a Python script sourcing the Stgit source\n> > (stgit/main.py to get commands, and then loading each class and iterating\n> > over the \"options\" module member).\n\n> I can add a function in stgit/main.py which would list the options.\n> The tla-completion generates a file listing a command with its option\n> on every line:\n\n>   push -a -all -n --number -t --to --reverse --undo -h --help\n>   ...\n\n> Since I don't know much about the bash completion, let me know of the\n> format you'd prefer.\nOk, I'll look into that. Probably it'll be around \"opts_push=\"-a --all -n \n--number...\", i.e. this one works fine, through name indirection, i.e. you \nsay \"expand the var which name is given by this expr\".\n\n> > Btw, what do you think about speeding up completions by reimplementing\n> > things like \"stg applied\" or \"stg unapplied\" via cat (as noted in the\n> > comments at the beginning of the script)? Tab completions can easily\n> > livelock a shell on a busy system, so it's worthy speeding the thing up.\n\n> In general, it is better to use the stg commands but the repository\n> structure won't probably change for a long time\nOk.\n> and it's OK to \n> optimise (if the speed improvement is visible).\nI believe it is, yes.\n> Anyway, these \n> particular commands are pretty fast (they behave like cat) but there\n> are others which are slower (usually the commands involving calls to\n> the GIT tool).\n\nThey _would_ behave like cat, except that Python is slow enough. Half a second \non a (almost) idle system means seconds and seconds on a busy system, and \nit's pretty frequent that when I don't wait enough for an op. to complete I \nget a traceback from the import statements, which haven't been completed. \n\nAnd let's leave Gentoo's emerge alone - I'd say imports can take up to a \nminute.\n-- \nInform me of my mistakes, so I can keep imitating Homer Simpson's \"Doh!\".\nPaolo Giarrusso, aka Blaisorblade (Skype ID \"PaoloGiarrusso\", ICQ 215621894)\nhttp://www.user-mode-linux.org/~blaisorblade\n\n\t\n\n\t\n\t\t\n___________________________________ \nYahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB \nhttp://mail.yahoo.it\n"},{"id":"10654","messageId":"b0943d9e0510260434y61dc5e50v@mail.gmail.com","threadId":"2219","inReplyTo":"200510251905.27768.blaisorblade@yahoo.it","subject":"Re: latest stg/git commandline completions code","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2005-10-26T11:34:22Z","receivedAt":"2005-10-26T11:34:22Z","isPatch":false,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 25/10/05, Blaisorblade <blaisorblade@yahoo.it> wrote:\n> They _would_ behave like cat, except that Python is slow enough. Half a second\n> on a (almost) idle system means seconds and seconds on a busy system, and\n> it's pretty frequent that when I don't wait enough for an op. to complete I\n> get a traceback from the import statements, which haven't been completed.\n\nThat's a thing I should fix in StGIT - trapping the exception\ngenerated by SIGTERM and exiting silently.\n\n> And let's leave Gentoo's emerge alone - I'd say imports can take up to a\n> minute.\n\nThat's probably because it checks the status of the tree before\nimporting but this command wouldn't be used to generate the\ncompletion.\n\n--\nCatalin\n"},{"id":"10667","messageId":"200510261814.04568.blaisorblade@yahoo.it","threadId":"2219","inReplyTo":"b0943d9e0510260434y61dc5e50v@mail.gmail.com","subject":"Re: latest stg/git commandline completions code","fromName":"Blaisorblade","fromEmail":"blaisorblade@yahoo.it","sentAt":"2005-10-26T16:14:04Z","receivedAt":"2005-10-26T16:14:04Z","isPatch":false,"sender":{"key":"blaisorblade@yahoo.it","avatar":null},"body":"On Wednesday 26 October 2005 13:34, Catalin Marinas wrote:\n> On 25/10/05, Blaisorblade <blaisorblade@yahoo.it> wrote:\n> > They _would_ behave like cat, except that Python is slow enough. Half a\n> > second on a (almost) idle system means seconds and seconds on a busy\n> > system, and it's pretty frequent that when I don't wait enough for an op.\n> > to complete I get a traceback from the import statements, which haven't\n> > been completed.\n\n> That's a thing I should fix in StGIT - trapping the exception\n> generated by SIGTERM and exiting silently.\nYep.\n\n> > And let's leave Gentoo's emerge alone - I'd say imports can take up to a\nWith imports I mean Python import statement, in the case of the Gentoo \n\"emerge\" command (which is written in Python).\n\nNot the import command (and checking the state of the tree can take tens of \nminutes, here - with a non-idle machine, though).\n> > minute.\n-- \nInform me of my mistakes, so I can keep imitating Homer Simpson's \"Doh!\".\nPaolo Giarrusso, aka Blaisorblade (Skype ID \"PaoloGiarrusso\", ICQ 215621894)\nhttp://www.user-mode-linux.org/~blaisorblade\n\n\t\n\n\t\n\t\t\n___________________________________ \nYahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB \nhttp://mail.yahoo.it\n"},{"id":"11314","messageId":"A44A02AA-BDA8-4623-825E-288F1107A5ED@hawaga.org.uk","threadId":"2219","inReplyTo":"200510251642.46169.blaisorblade@yahoo.it","subject":"Re: latest stg/git commandline completions code","fromName":"Ben Clifford","fromEmail":"benc@hawaga.org.uk","sentAt":"2005-11-08T10:16:28Z","receivedAt":"2005-11-08T10:16:28Z","isPatch":false,"sender":{"key":"benc@hawaga.org.uk","avatar":"https://gravatar.com/avatar/c7ce083471287f8e77b69dd147f757799d1efdd740727fd7e3003f33e88be898?d=mp&s=160"},"body":"\n\n> I'm using stgit on the Linux kernel so when on a command I don't  \n> have tab\n> completion I add the needed one (having the time and feeling to do  \n> it).\n>\n> However, it's still done with enough care and polish to be shippable.\n>\n>\n\nI've added some stuff to this to do a few cogito, gitk and (one) git  \ncompletions, split into different files. I thought I might as well  \ntoss what I have out for anyone interested to play with.\n\nI tried to put it in a new git repo online, but I'm having  \ndifficulties - the poor link I'm on makes it not so much fun to  \nexperiment. So I've tarred up my local repo warts and all and put it at:\n\nhttp://www.hawaga.org.uk/ben/tech/gitcompletion- \na108bdc110dad770ec5c092759a8bc511790d21f.tar\n\nBen\n-- \nBen Clifford\nhttp://www.hawaga.org.uk/ben/\n"},{"id":"11414","messageId":"20051109222338.GK16061@pasky.or.cz","threadId":"2219","inReplyTo":"A44A02AA-BDA8-4623-825E-288F1107A5ED@hawaga.org.uk","subject":"Re: latest stg/git commandline completions code","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-11-09T22:23:38Z","receivedAt":"2005-11-09T22:23:38Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, Nov 08, 2005 at 11:16:28AM CET, I got a letter\nwhere Ben Clifford <benc@hawaga.org.uk> told me that...\n> I've added some stuff to this to do a few cogito, gitk and (one) git  \n> completions, split into different files. I thought I might as well  \n> toss what I have out for anyone interested to play with.\n> \n> I tried to put it in a new git repo online, but I'm having  \n> difficulties - the poor link I'm on makes it not so much fun to  \n> experiment. So I've tarred up my local repo warts and all and put it at:\n> \n> http://www.hawaga.org.uk/ben/tech/gitcompletion- \n> a108bdc110dad770ec5c092759a8bc511790d21f.tar\n\nNice, I would like to add cg completion to Cogito's contrib/ - could you\nplease add some header to it with (c) information and stuff? (And make\nit available somewhere just as a plain file.)\n\nBesides, it would be probably best to just autogenerate the\nauto-completion code - the usage information in Cogito is supposed to be\n100% consistent and correct, so it should be a reliable source for that.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nVI has two modes: the one in which it beeps and the one in which\nit doesn't.\n"},{"id":"11450","messageId":"33CE6BA8-415D-405F-89B3-982811C3A0CF@hawaga.org.uk","threadId":"2219","inReplyTo":"20051109222338.GK16061@pasky.or.cz","subject":"Re: latest stg/git commandline completions code","fromName":"Ben Clifford","fromEmail":"benc@hawaga.org.uk","sentAt":"2005-11-10T01:59:09Z","receivedAt":"2005-11-10T01:59:09Z","isPatch":false,"sender":{"key":"benc@hawaga.org.uk","avatar":"https://gravatar.com/avatar/c7ce083471287f8e77b69dd147f757799d1efdd740727fd7e3003f33e88be898?d=mp&s=160"},"body":"\nOn 10 Nov 2005, at 09:23, Petr Baudis wrote:\n>\n> Nice, I would like to add cg completion to Cogito's contrib/ -  \n> could you\n> please add some header to it with (c) information and stuff? (And make\n> it available somewhere just as a plain file.)\n\nOK, will do.\n\n> Besides, it would be probably best to just autogenerate the\n> auto-completion code - the usage information in Cogito is supposed  \n> to be\n> 100% consistent and correct, so it should be a reliable source for  \n> that.\n\nyeah, I was thinking about that this morning -- maybe I'll be in the  \nmood to implement...\n\nThere are a few small common functions that are used by all the git  \ncompletions, though. I suppose for going into cogito's contrib/ I  \nshould include them directly in cogito completion code, but that  \nseems a little messy, as it would be nice to keep them in-sync with  \nwhat is used in the other completion files. hmm.\n\nBen\n\n-- \nBen ベン Бэн\nhttp://www.hawaga.org.uk/ben/\n"},{"id":"11451","messageId":"40549FF6-EB51-4756-B9B9-31724F701300@hawaga.org.uk","threadId":"2219","inReplyTo":"20051109222338.GK16061@pasky.or.cz","subject":"Re: latest stg/git commandline completions code","fromName":"Ben Clifford","fromEmail":"benc@hawaga.org.uk","sentAt":"2005-11-10T02:03:37Z","receivedAt":"2005-11-10T02:03:37Z","isPatch":false,"sender":{"key":"benc@hawaga.org.uk","avatar":"https://gravatar.com/avatar/c7ce083471287f8e77b69dd147f757799d1efdd740727fd7e3003f33e88be898?d=mp&s=160"},"body":"\nOn 10 Nov 2005, at 09:23, Petr Baudis wrote:\n\n> Dear diary, on Tue, Nov 08, 2005 at 11:16:28AM CET, I got a letter\n> where Ben Clifford <benc@hawaga.org.uk> told me that...\n>\n>> I've added some stuff to this to do a few cogito, gitk and (one) git\n>> completions, split into different files. I thought I might as well\n>> toss what I have out for anyone interested to play with.\n\nbtw, I got the repository for this working (it was working all along,  \nit seems)...\n\ncg clone http://www.hawaga.org.uk/gitcompletion.git\n\n-- \nBen ベン Бэн\nhttp://www.hawaga.org.uk/ben/\n"},{"id":"11458","messageId":"CDEAA4E3-54FE-4825-BFCF-DCE34DBD138A@hawaga.org.uk","threadId":"2219","inReplyTo":"20051109222338.GK16061@pasky.or.cz","subject":"Re: latest stg/git commandline completions code","fromName":"Ben Clifford","fromEmail":"benc@hawaga.org.uk","sentAt":"2005-11-10T06:57:34Z","receivedAt":"2005-11-10T06:57:34Z","isPatch":false,"sender":{"key":"benc@hawaga.org.uk","avatar":"https://gravatar.com/avatar/c7ce083471287f8e77b69dd147f757799d1efdd740727fd7e3003f33e88be898?d=mp&s=160"},"body":"On 10 Nov 2005, at 09:23, Petr Baudis wrote:\n\n\n\n\n\n\n> Besides, it would be probably best to just autogenerate the\n> auto-completion code - the usage information in Cogito is supposed  \n> to be\n> 100% consistent and correct, so it should be a reliable source for  \n> that.\n>\n>\n>\n>\n\nMaybe reliable and consistent but I think that info would need a bit  \nof augmentation to use for specifying autocompletion - for example,  \nin the case of:\n\n > Usage: cg-branch-add BRANCH_NAME LOCATION\n\nBRANCH_NAME should *not* exist so it doesn't make sense to  \nautocomplete from the branch list, but in the case of:\n\n > Usage: cg-fetch [-f] [-v] [BRANCH_NAME]\n\nBRANCH_NAME *must* exist so it makes sense to autocomplete from the  \nbranch list.\n\nThe amount of augmentation is probably not too much -  probably  \nsufficient  to specify for each parameter a completion-source(s)  \n(heads, branches, filenames, blah) that doesn't get displayed in -- \nhelp. But this is more information to maintain and get out of date...\n\nI wonder if Nikolai has had thoughts about that for zsh completion?\nHopefully if anything gets added, it would be useful for both zsh and  \nbash\n\n(I confess to having pretty much no idea how zsh completion works...)\n\nBen\n\n-- \nBen ベン Бэн\nhttp://www.hawaga.org.uk/ben/\nMy email is high latency but best way to contact me. Alternatively,  \nSMS numbers at above URL.\n"},{"id":"11464","messageId":"20051110094013.GM30496@pasky.or.cz","threadId":"2219","inReplyTo":"CDEAA4E3-54FE-4825-BFCF-DCE34DBD138A@hawaga.org.uk","subject":"Re: latest stg/git commandline completions code","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-11-10T09:40:13Z","receivedAt":"2005-11-10T09:40:13Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Nov 10, 2005 at 02:59:09AM CET, I got a letter\nwhere Ben Clifford <benc@hawaga.org.uk> said that...\n> There are a few small common functions that are used by all the git  \n> completions, though. I suppose for going into cogito's contrib/ I  \n> should include them directly in cogito completion code, but that  \n> seems a little messy, as it would be nice to keep them in-sync with  \n> what is used in the other completion files. hmm.\n\nThen could you please separate those from the git completion to some\nkind of 'library'?\n\nDear diary, on Thu, Nov 10, 2005 at 07:57:34AM CET, I got a letter\nwhere Ben Clifford <benc@hawaga.org.uk> said that...\n> On 10 Nov 2005, at 09:23, Petr Baudis wrote:\n> >Besides, it would be probably best to just autogenerate the\n> >auto-completion code - the usage information in Cogito is supposed  \n> >to be\n> >100% consistent and correct, so it should be a reliable source for  \n> >that.\n> \n> Maybe reliable and consistent but I think that info would need a bit  \n> of augmentation to use for specifying autocompletion - for example,  \n> in the case of:\n> \n> > Usage: cg-branch-add BRANCH_NAME LOCATION\n> \n> BRANCH_NAME should *not* exist so it doesn't make sense to  \n> autocomplete from the branch list, but in the case of:\n\nWhen you do\n\n\tcat > <tab><tab>\n\nbash happily autocompletes as well. I don't think this is a problem,\nbesides it can be useful when you want to use some existing branch name,\njust slightly modified.\n\n> The amount of augmentation is probably not too much -  probably  \n> sufficient  to specify for each parameter a completion-source(s)  \n> (heads, branches, filenames, blah) that doesn't get displayed in -- \n> help. But this is more information to maintain and get out of date...\n\nIt's enough if we auto-build the completion and complain loudly and\nerror out when we hit something unknown.\n\n> (I confess to having pretty much no idea how zsh completion works...)\n\nMe neither. :-)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nVI has two modes: the one in which it beeps and the one in which\nit doesn't.\n"},{"id":"11991","messageId":"6387EBD2-F476-4A43-B764-3D9F2B653483@hawaga.org.uk","threadId":"2219","inReplyTo":"20051110094013.GM30496@pasky.or.cz","subject":"Re: latest stg/git commandline completions code","fromName":"Ben Clifford","fromEmail":"benc@hawaga.org.uk","sentAt":"2005-11-16T03:35:42Z","receivedAt":"2005-11-16T03:35:42Z","isPatch":false,"sender":{"key":"benc@hawaga.org.uk","avatar":"https://gravatar.com/avatar/c7ce083471287f8e77b69dd147f757799d1efdd740727fd7e3003f33e88be898?d=mp&s=160"},"body":"\n>> There are a few small common functions that are used by all the git\n>> completions, though.\n\n> Then could you please separate those from the git completion to some\n> kind of 'library'?\n\nthat's done now.\n\n\n> When you do\n>\n>     cat > <tab><tab>\n>\n> bash happily autocompletes as well. I don't think this is a problem,\n> besides it can be useful when you want to use some existing branch  \n> name,\n> just slightly modified.\n\nok, convinced - I changed 'branch' and 'checkout' to complete on new  \nbranch name.\n\nhttp://www.hawaga.org.uk/gitcompletion/git-compl-lib\nhttp://www.hawaga.org.uk/gitcompletion/cg-compl\n\nare the two latest versions of the code (source the -lib then the cg-  \nfile)\n\nThere is no autogeneration - I'm still playing round. Its just good- \nold-fashioned manually hard coded.\n\nThe git repo that I'm keeping this and the other completion code  \n(stg, git and gitk) in is at http://www.hawaga.org.uk/gitcompletion.git\n\n-- \nBen ベン Бэн\nhttp://www.hawaga.org.uk/ben/\nMy email is high latency but best way to contact me. Alternatively,  \nSMS number(s) at above URL.\n"}]}