Skip to content

Two bugs in bashcompletion for classical naval app #15

@remort

Description

@remort

Classical naval app is in my /usr/bin/naval file:

#!/usr/bin/python3

"""Naval Fate.

Usage:
  naval_fate.py ship new <name>...
  naval_fate.py ship <name> move <x> <y> [--speed=<kn>]
  naval_fate.py ship shoot <x> <y>
  naval_fate.py mine (set|remove) <x> <y> [--moored | --drifting]
  naval_fate.py (-h | --help)
  naval_fate.py --version

Options:
  -h --help     Show this screen.
  --version     Show version.
  --speed=<kn>  Speed in knots [default: 10].
  --moored      Moored (anchored) mine.
  --drifting    Drifting mine.

"""
from docopt import docopt


if __name__ == '__main__':
    arguments = docopt(__doc__, version='Naval Fate 2.0')
    print(arguments)

Generate autocomletion for that via docopt-completion naval and have 2 bugs:

  1. commands completes with variety of files in current dir except naval commands. Looking in bashcompletion file gave me that:
    COMPREPLY=( $( compgen -fW ' move shoot new' -- $cur) )

it should be just compgen -W, not -fW. f id sor files, i suppose.

  1. pressing tab after naval mine set ..pressing tab.. gives me nothing or filnames in current dir. But it should print me --moored --drifting and probably <x> <y>.

If i type naval mine set 10 10 ..press tab.. it gives me nothing neither.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions