TAB Key
Back during JANOS development Kevin brought it to my attention how the TAB key was being used on the command line in other systems. Basically it served as an auto-complete function.
The TAB has been implemented in JANOS with some twists. Once you work with a Series 4 at the command line you just can’t handle a Series 3 where you have to type every character.
Where a file path or file name is expected the TAB will cycle through all of the valid names. For example In the following video I will type CAT and space and then hit TAB a few times slowly. When the desired file name appears I can hit ENTER. Let’s see jniorboot.log
without typing jniorboot.log
.
In the above post Bruce showed us how to use the TAB as an autocomplete for the commands that are available from the command line.
My favorite feature of the TAB autocomplete is filling out file names. In this quick video you will see that there are two files that names that begin with ‘jn’. You will see that i start typing the filename for ‘jniorsys.log’. I use the TAB key to cycle through the file names that start with “jn’.
Another great place that the TAB work is when working with the registry from the command line. “Who does that?” you ask. I do. Yes the registry tab in the DCP is wonderful but for some, yours truly, the command line is faster. Especially when the TAB is utilized!
In this video I want to change the hostname. Yes, there is a hostname command but I want to show how to use the registry from the command line.
You will see that i use ‘reg’ which is the alias for registry. I type ‘i’ then TAB to look through registry keys that start with ‘i’. I select the ‘IpConfig’ folder. Now I use TAB to cycle through the available registry keys. Once i find hostname I type ‘ =” and TAB again to see the value.
Use of the up arrow will enter the previous command and then I edit the key value using backspace and enter my change. Now the hostname is ‘kev-dev’
Take a look
In general the TAB performs context specific auto-complete.
By using TAB repeatedly each valid completion is displayed. If you find the a form of the entry that is appropriate you simply continue to build the command line and hit ENTER to execute. Generally TAB offers matching file and folder names from the current working folder or other folder if specified by preceding content on the command line.
You may begin to type an entry and then use TAB. Only those completions which incorporate the starting characters are shown. So if you wish to filter the possibilities you can enter the first or first couple of characters. Similarly you can enter a path to a folder and completions will be content from that folder.
A TAB used within the first word on a line will auto-complete valid commands and lines from those previously entered. Recently entered command lines are preserved in a history (See HISTORY command) which you can normally access using UP-ARROW and DN-ARROW. The TAB auto complete will include your history. So if you want to execute a MANIFEST command with the same options that you had previously run, you could hit ‘m’ followed by TAB and that complete command line will be one of the completions offered. Completions for the first word on a line will also include normal file entries which may be useful if you want to execute a program.
If the REGISTRY or REG command is being built, TAB instead offers completion options from the set of matching Registry Keys instead of folder content. In this case too the TAB can be used immediately after the ‘=’ to complete the balance of the REGISTRY command with the current content of the specified key.
With some experience you learn to use TAB efficiently and rarely need to enter an entire filename or Registry Key.
For example once you have copied a UPD file to the /temp
folder you can generally execute the JRUPDATE command very quickly with the following keystrokes. This assumes that the UPD file is the sole occupant of that temporary folder.
jru[TAB][SP]-fup[SP]t[TAB]/[TAB][ENTER]
Note that TAB presents you with optional auto-completion text alphabetically.