Hello programmers :),

I'm creating a program that requires too many command line parameters to run. I noticed that many system programs in Ubuntu (my operating system) have the feature of auto-completion of the command line parameters. So, for example, if you type the following in Ubuntu:

sudo apt-get i<tab>

you get the full word you need written as

sudo apt-get install

So is it possible to do this in C++? share the internal command-line parameters with console?

Thank you guys for any efforts :)

Recommended Answers

All 5 Replies

That is not a part of the program itself as the program is not running until <Enter> has been pushed on a valid command line.

It is a function of the shell (Bash) what I can not tell you is if it is built into the shell or if the shell is reading a file somewhere allowing you to provide auto-completion data to the shell for your program.

[]

How would you investigate such a thing? is it possible at any rate?

Well I did a web search on "linux command line parameter autocomplete" and read the linked articles.

There is related stuff in

/etc/bash_completion.d/
/etc/bash_completion

This is really a Linux not a C++ question so I would recomend you find a good Linux forum and ask there.

Thanks buddy. I'll go for it :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.