ARCHIVE / What is tab completion?

Tab completion is a feature provided by many command-line interfaces that allows the pressing of the Tab key on one's keyboard to automatically complete a portion of a command-line expression insofar as it is possible to do so. To be clearer, a command-line expression is an instruction typed into a command-line interface that consists of functions, modifiers and/or operators, possibly acting upon values and/or variables. For example, in the Microsoft Windows Command Prompt, typing in "echo test" is an expression consisting of a function named "echo" and a value named "test". Pressing the Enter button causes the expression to be run or executed and a result to be generated, in this case the repetition of the value "test" in the line below. In a SQL-based command-line database interface, typing in the expression "SELECT COUNT(*) FROM my_table;" and pressing the Enter button causes the expression to be run or executed and a result to be generated. If you actually have a table in the database named "my_table", the expression will return the number of rows in the table. Otherwise, the result will be an error.

As command-line expressions can get very complicated, tab completion is meant to assist people with writing valid, though not necessarily correct, expressions. For example, if using the Microsoft Windows Command Prompt and currently in a directory named "Alpha" with a subdirectory named "Beta", one can type "cd Be" and press the Tab key to complete the expression. However, if another directory named "Betsy" exists in the Alpha directory, tab completion can only determine what is possible and will result in either the incomplete expression "cd Bet", such as on UNIX systems, or else offer one of the available options, as with the Microsoft Windows Command Prompt. In many cases, pressing the Tab key again will either display a list of possibilities or else cycle through them. Likewise, in a SQL-based command-line database interface, typing in "sel" and pressing the Tab key should cause the "SELECT" function to be displayed as it is the only available option at that point in the expression. But, typing in "co" after the "SELECT " part of the expression is not sufficient to determine that one actually means to write "SELECT COUNT(*)". Continuing to the write out "SELECT COUNT(*) FROM my", however, may be enough to determine that the "my" is the beginning of "my_table", again assuming that no other similar options are available. Once one becomes accustomed to writing expressions using tab completion, it becomes significantly easier and faster to write complex expressions using a command-line interface.

last updated 2008.03.01

RELATED TOPICS

 

Terms of Use · Privacy Policy ©2021