On Sun, Jul 8, 2018 at 7:28 PM Bakul Shah <bakul@bitblocks.com> wrote:
[...]
I believe autocompletion has been available for 20+ years. IIRC, I
switched to zsh in 1995 and it has had autocompletion then. But you
do have to teach zsh/bash how to autocomplete for a given program.

csh has had filename auto-completion since the late 70s or early 80s, though nowhere as rich or as full-featured as bash/zsh, let alone TOPS-20.

[...]

This sort of magic incantation is needed because no one has bothered
to create a simple library for autocompletion & no standard convention
has sprung up that a program can use. It is not entirely trivial but
not difficult either.

This. Much of the issue with Unix was convention, or rather, lack of a consistent convention. Proponents of DEC operating systems that I've known decry that Unix can't do stuff like, `RENAME *.FTN *.FOR`, because the shell does wildcard expansion. Unix people I know will retort that that behavior depends on programming against specific libraries. I think the big difference is that the DEC systems really encouraged using those libraries and made their use idiomatic and trivial; it was such a common convention that NOT doing it that way was extraordinary. On the other hand, Unix never mandated any specific way to do these things; as a result, everyone their own thing. How many times have you looked at a Unix utility of, er, a certain age, and seen `main()` start something like:

main(argc, argv)
        int argc;
        char *argv[];
{
        if (--argc > 0 && *argv[1] == '-') {
                argv++;
                while (*++*argv)
                switch (**argv) {
                case 'a':
                        /* etc.... */
                        continue;
                }
        }
        /* And so on.... */

I mean, goodness: we didn't even use getopt(3)! It was all hand-rolled! And thus inconsistent.

Cisco's CLI is a great model for this. It would
even prompt you with a help string for non-keyword args such as ip
address or host! With Ciscso CLI ^D to list choices, ^I to try auto
complete and ? to provide context sensitive help. It was even better
in that you can get away with just typing a unique prefix. No need to
hit <tab>. Very handy for interactive use.

This is unsurprising as the Cisco CLI is very clearly modeled after TOPS-20/TENEX which did all of those things (much of which was in the CMND JSYS after work transferred to DEC and TENEX became TOPS-20). It's definitely one of the cooler features of twenex.

        - Dan C.