I am trying to add autocomplete functionality to my command line application. So far all the answers are saying that it is priority of the shell but in my case it is different. My program goes into a loop (to get commands) in main()
, so I don't think it has anything to do with shell. How can I achieve such goal?
This following is my program. It starts parsing when the user hits enter (std::getline()
). How can I get user input at runtime without using any external libraries?
while (input != "exit") {
std::cout << "\nCommand >> ";
std::getline(std::cin, input);
com.parse(input);
}
As David Rodríguez said, using readline GNU does the job (I had to use a library) in linux.
This is the official documentation, it has some C examples but they are too confusing, so I used this to create my custom autocompletion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With