Results 1 to 5 of 5

Thread: commandline app autocomplete

  1. #1
    Join Date
    Oct 2010
    Beans
    22

    commandline app autocomplete

    Hi,

    I'm thinking of creating a commandline utility. As a feature, I'd like it to be able to autocomplete on argument strings sort of like how bash autocompletes files or directories w/ Tab.

    Is there a library out there that will allow me to do this? By pressing Tab, the utility would give suggestions for a list of options stored in a file.

    Thanks,

  2. #2
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,274
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: commandline app autocomplete

    Hi psychotix.

    A practical option is to study the current auto completion scripts. They all reside here:
    Code:
    /etc/bash_completion.d
    Be careful not to modify them, as usually bad autocompletion scripts screw up the terminal experience .

    Just a thought.
    Regards.

  3. #3
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,294
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: commandline app autocomplete

    That's not at all what he wants though, he wants to have Tab-completion in his program, not in Bash.
    「明後日の夕方には帰ってるからね。」


  4. #4
    Join Date
    Feb 2009
    Location
    Dallas
    Beans
    1,411
    Distro
    Ubuntu Gnome 14.04 Trusty Tahr

    Re: commandline app autocomplete

    The user will have to be running the program already and then give arguments instead of giving them while launching the program. The auto complete in the terminal already is done by the shell, but the shell has no way to know what your arguments are (or their options). Traditionally giving bad arguments just spits back the help.

  5. #5
    Join Date
    Oct 2010
    Beans
    22

    Re: commandline app autocomplete

    I think I'll look at what papibe suggested.

    Thanks!

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •