dim-an/cod

cod does not learn that flags belong to subcommands

Closed this issue · 1 comments

The pwntools project uses a single entry point, pwn, for all of its subcommands.

COD correctly learns the subcommands, but then when learning the flags that belong to a specific subcommand, elevates them to the top-level command.

Subcommands are learned:

$ pwn --help
usage: pwn [-h]
           {asm,checksec,constgrep,cyclic,debug,disasm,disablenx,elfdiff,elfpatch,errno,hex,phd,pwnstrip,scramble,shellcraft,template,unhex,update}
...
┌──> /Users/zachriggle/.pyenv/shims/pwn --help
└─── cod: learn this command? [yn?] > y
cod: learned completions: "asm" "checksec" "constgrep" and 17 more
$ pwn <tab>
--help      asm         constgrep   debug       disasm      elfpatch    hex         pwnstrip    shellcraft  unhex
-h          checksec    cyclic      disablenx   elfdiff     errno       phd         scramble    template    update

However, when learning a subcommand's flags, they apply to the top-level pwn command.

$ pwn phd --help
...
┌──> /Users/zachriggle/.pyenv/shims/pwn phd --help
└─── cod: learn this command? [yn?] >
cod: learned completions: "-h" "--help" "-w" "--width" "-l" and 7 more
$ pwn <tab>
--color     --offset    -c          -o          asm         cyclic      disasm      errno       pwnstrip    template
--count     --skip      -h          -s          checksec    debug       elfdiff     hex         scramble    unhex
--help      --width     -l          -w          constgrep   disablenx   elfpatch    phd         shellcraft  update

I have a plan to implement this in the future.