[COFF] Other OSes?

Bakul Shah bakul at bitblocks.com
Mon Jul 9 09:27:54 AEST 2018


On Jul 8, 2018, at 1:50 PM, Perry E. Metzger <perry at piermont.com> wrote:
> 
> On Thu, 5 Jul 2018 15:56:50 +1000 Warren Toomey <wkt at tuhs.org> wrote:
>> OK, I guess I'll be the one to start things going on the COFF list.
>> 
>> What other features, ideas etc. were available in other operating
>> systems which Unix should have picked up but didn't?
>> 
>> [ Yes, I know, it's on-topic for TUHS but I doubt it will be for
>> long! ]
> 
> A minor feature that I might mention: TOPS-20 CMND JSYS style command
> completion. TL;DR, this feature could now be implemented, as after
> decades of wanting it I finally know how to do it in a unixy way.
> 
> In TOPS-20, any time you were at the EXEC (the equivalent of the
> shell), you could hit "?" and the thing would tell you what options
> there were for the next thing you could type, and you could hit ESC to
> complete the current thing. This was Very Very Nice, as flags and
> options to programs were all easily discoverable and you had a handy
> reminder mechanism when you forgot what you wanted.
> 
> bash has some vague lame equivalents of this (it will complete
> filenames if you hit tab etc.), and if you write special scripts you
> can add domain knowledge into bash of particular programs to allow for
> special application-specific completion, but overall it's kind of lame.
> 
> Here's the Correct Way to implement this: have programs implement a
> special flag that allows them to tell the shell how to do completion
> for them! I got this idea from this feature being hacked in, in an ad
> hoc way, into clang:
> 
> http://blog.llvm.org/2017/09/clang-bash-better-auto-completion-is.html
> 
> but it is apparent that with a bit of work, one could standardize such
> a feature and allow nearly any program to provide the shell with such
> information, which would be very cool. Best of all, it's still unixy
> in spirit (IMHO).

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.
For instance

  compctl -K listsysctls sysctl
  listsysctls() { set -A reply $(sysctl -AN ${1%.*}) }

The compctl tells the shell what keyword list to use (lowercase k)
or command to use to generate such a list (uppercase K). Then the
command has to figure out how to generate such a list given a prefix.

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. 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.





More information about the COFF mailing list