On our Linux systems, I can up-arrow to go back to prior commands and use the 
left and right arrows to navigate a line. The functionality may be provided 
internally by readline. I’ve never had to dig into it because it meets my needs 
out of the box.

From: Python-list <python-list-bounces+gweatherby=uchc....@python.org> on 
behalf of Grant Edwards <grant.b.edwa...@gmail.com>
Date: Friday, March 10, 2023 at 9:39 AM
To: python-list@python.org <python-list@python.org>
Subject: Re: Baffled by readline module
*** Attention: This is an external email. Use caution responding, opening 
attachments or clicking on links. ***

On 2023-03-10, Weatherby,Gerard <gweathe...@uchc.edu> wrote:

> I would say, “No, readline is not the right tool.”
>
> cmd.Cmd is: 
> https://urldefense.com/v3/__https://docs.python.org/3/library/cmd.html__;!!Cn_UX_p3!iH9PMR4wNfv3oBLWR_W46RY8KUzLVxsA_XRv2RJk6Td_ND59EaBvcJ58-Crx2PReX-ELMx7IEMAQ1YfpIt7xmHBGs8a1$<https://urldefense.com/v3/__https:/docs.python.org/3/library/cmd.html__;!!Cn_UX_p3!iH9PMR4wNfv3oBLWR_W46RY8KUzLVxsA_XRv2RJk6Td_ND59EaBvcJ58-Crx2PReX-ELMx7IEMAQ1YfpIt7xmHBGs8a1$>
>  . I have a
> couple of cmd.Cmd modules, one of which I use daily and the other
> weekly.

I'll have to remember that one. It doesn't really fit my current use
case, but there are others where it would work nicely.

However, cmd.Cmd does not provide command recall and
editing. According to the page above, that's provided by the readline
module:

     If the readline module is loaded, input will automatically
     inherit bash-like history-list editing (e.g. Control-P scrolls
     back to the last command, Control-N forward to the next one,
     Control-F moves the cursor to the right non-destructively,
     Control-B moves the cursor to the left non-destructively, etc.).

--
Grant
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!iH9PMR4wNfv3oBLWR_W46RY8KUzLVxsA_XRv2RJk6Td_ND59EaBvcJ58-Crx2PReX-ELMx7IEMAQ1YfpIt7xmEU_EBpr$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!iH9PMR4wNfv3oBLWR_W46RY8KUzLVxsA_XRv2RJk6Td_ND59EaBvcJ58-Crx2PReX-ELMx7IEMAQ1YfpIt7xmEU_EBpr$>
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to