Talk:Readline interface: Difference between revisions

→‎a simple program ...: the program may be simple, not the readline implementation
m (→‎What is meant by "history"?: added comments about which key is used for command retrieval. -- ~~~~)
(→‎a simple program ...: the program may be simple, not the readline implementation)
Line 7:
 
==a simple program ...==
I think anyone attempting this task will soon find that's it not simple to provide a "history" suitable for re-doing commands. Witness Microsoft's DOS with its ''up arrow'' (retrieve/re-do) function along with all the F1 --> F12 functions, the latter being too complicated to use and hard to remember which function key does what (I still ponder, what where those coders thinking?). I was going to add such functionality to the REXX example, but the code would've been far from simple. So I elected to just have the option for the user to list the history of all commands entered, and let the user pick which one (by number), or just choose the last command to re-execute. I couldn't added more support to just limit the last ''n'' entries (for the command history), and/or let the user choose how many commands to list. But again, that would've added more complexity to an already burgeoning program, and the goal of the task was to implement a '''simple''' (ha!, good luck with that!) program, and in that, I fear, I may have failed. I hope I showed how to add commands, handle aliases, and full abbreviations (modeled after IBM VM/CMS version of what abbreviations are). Of course, one man's simple program is another's monstrosity. -- [[User:Gerard Schildberger|Gerard Schildberger]] 17:12, 1 June 2012 (UTC)
:i don't get what you mean. what exactly is the issue with the up arrow? it works fine in about any shell or readline interface i know.--[[User:EMBee|eMBee]] 13:30, 18 June 2012 (UTC)
 
I was going to add such functionality to the REXX example, but the code would've been far from simple.
:well, i can see that writing the code to actually implement all that functionality may not be trivial. but this task was mostly intended to get examples of using already existing libraries or modules which should not be hard.--[[User:EMBee|eMBee]] 13:30, 18 June 2012 (UTC)
So I elected to just have the option for the user to list the history of all commands entered, and let the user pick which one (by number), or just choose the last command to re-execute. I couldn't added more support to just limit the last ''n'' entries (for the command history), and/or let the user choose how many commands to list. But again, that would've added more complexity to an already burgeoning program, and the goal of the task was to implement a '''simple''' (ha!, good luck with that!) program, and in that, I fear, I may have failed.
:simple was referring to what the program does besides having a readline interface. consider the C example, which only supports one command: help. that's simple. if you have to implement the whole readline functionality yourself because the language doesn't already provide an implementation, then that's of course not simple. and it wasn't expected to be. --[[User:EMBee|eMBee]] 13:30, 18 June 2012 (UTC)
I hope I showed how to add commands, handle aliases, and full abbreviations (modeled after IBM VM/CMS version of what abbreviations are). Of course, one man's simple program is another's monstrosity. -- [[User:Gerard Schildberger|Gerard Schildberger]] 17:12, 1 June 2012 (UTC)
Anonymous user