Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto completion on commands #1118

hmatthes opened this issue Jun 30, 2020 · 2 comments

Auto completion on commands #1118

hmatthes opened this issue Jun 30, 2020 · 2 comments
help wanted Looking for Contributors


Copy link

hmatthes commented Jun 30, 2020

When I am a helper at teaching the shell lesson, one common learner's comment on the explanations about getting help for commands via the --help option or the man pages is that both won't help you if you do not already know the name of the specific command for your task. Of course, to some extent, that is what the cheat sheet is for. However, when I was a beginner with shell and not used to typing commands or application names instead of just clicking an icon, I frequently only remembered part of a command's name but not the full or correct name. I don't know how often I typed some weird, non-existing palindrome of acroread when I started using shell, until some told me I could just type acr and tab for auto completion!

Therefor, I think it would be useful at some point to explain that the auto completion introduced in Episode 2 for file names, paths or directories also works on commands and application names. A good place to put this, without adding considerable extra time to any of the lessons, would be in Episode 3 Working With Files and Directories, where Nano is introduced as a text editor. After the Which editor? explanation, it would be easy to put something along the lines of "Now what was the name of the editor we were going to use? - It started with na! - So if we type na in the command line and press tab for auto completion, we get a list of all commands and application names staring with na. - There it is: nano!"

I know this is more of a side line than an actual addition to the lesson, but I also think it would be good to make learners aware of this possibility.

Copy link

matthewabrown commented Jun 30, 2020

I like the suggestion. I find tab-completion to be a crutch I rely on in a big way and it is clearly in the high value, low effort quadrant.

I can imagine some difficulties with getting this to work consistently though:

Inconsistency of output:
With the file set included in the lesson, we know exactly which files will work with which prefixes and tab-completion. But with commands, there will be variation among systems in the wild. For example, on my system I have five possible completions for the "na" prefix, so I have to use the double-tab and see a different list than you might.

Possible digression into PATH, environment variables, and startup scripts:
I'm anticipating the question: "How can I know which programs on my system will tab-complete?" or similar related questions. The difficulty is that this really depends on the environment which can be difficult to explain and will be inconsistent among systems.

I don't think these are deal-breakers, necessarily. We just have to figure out how to say just the right amount in the lesson and not get caught up in distractions.

Copy link

gdevenyi commented Jul 2, 2020

I would 👍 for a callout explaining this idea and its usefulness, and explicitly call out that there are murky areas we simply won't describe because its out-of-scope. There might be something already in shell-extras about PATH and such, if not, contributions welcome :)

@gcapes gcapes added the help wanted Looking for Contributors label Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
help wanted Looking for Contributors
None yet

No branches or pull requests

4 participants