[Info-vax] Filename completion, was: Re: VMS Features I Wish Linux Had

Paul Sture nospam at sture.ch
Fri Jun 10 16:14:29 EDT 2016


On 2016-06-10, 
Simon Clubley <clubley at remove_me.eisner.decus.org-Earth.UFP> wrote:
> On 2016-06-10, John E. Malmberg <wb8tyw at qsl.net_work> wrote:
>>
>> One issue with the VMS terminal line editing is because it is handled in 
>> the driver, it does not have access to the filesystem to allow it to do 
>> filename completion.
>>
>
> That's easy enough to fix with some enhancements. Assume you want to
> emulate the bash tab completion model which is the most elegant way
> I've come across so far. One suggestion (which would have to be turned
> on by the caller (ie: the shell/CLI) as required):
>
> Make the Tab an input termination character and pass back to the caller
> the fact that Tab was pressed _and_ the position in the input line it
> was pressed at. This position is basically a one-dimensional cursor.
>
> The shell/CLI calls a lib$expand_filenames with the line and cursor
> position within the line. It fills in whatever unique characters it
> can, modifies the cursor position in the line as required and passes
> back to the caller a list of matching filenames so the caller can
> display them to the user.
>
> The shell/CLI then issues a new read to VMS with the modified line and
> cursor position within the line and the user then carries on typing.
>
> For this to work properly, the VMS terminal driver needs the ability
> to edit across lines, including the ability to move back up a line on
> the screen so that when there's only one matching filename the visual
> effect is that the full filename is inserted and any text to the right
> of the line cursor is scrolled to the right, including across any line
> boundaries as required.
>
> Don't forget that you may type in a command line (or recall it) and
> then go and change a filename within the middle of the command line.
> The above scheme handles that and gives you terminal driver editing
> _and_ filename completion.
>

In addition to your well thought out reply...

 UUIDs are also a candidate for command completion:

<https://marclop.svbtle.com/smartos#vmadmd_2>

"Most commands operate on VMs by UUID. In SmartOS, there are included
bash tab-completion rules so that you can tab-complete UUIDs rather than
having to type them out for every command."

Demo:

# vmadm list
UUID                                  TYPE  RAM STATE    ALIAS
8ae7996e-1f9b-49ee-b0af-1650b2ecdd6f  OS    256 running  datasets1
6bca0a13-b994-4946-bcf0-477da87396fc  OS    512 running  pysci
...


# vmadm stop 8a<TAB>

autocompletes to give:

# vmadm stop 8ae7996e-1f9b-49ee-b0af-1650b2ecdd6f

It's invaluable when working on a physical console without copy
and paste functionality.

-- 
There are two hard things in computer science, and they are cache invalidation,
naming, and off-by-one errors.



More information about the Info-vax mailing list