Skip Menu |

This queue is for tickets about the CLI-Framework CPAN distribution.

Report information
The Basics
Id: 56884
Status: open
Priority: 0/
Queue: CLI-Framework

People
Owner: Nobody in particular
Requestors: ghewson [...] wormhole.me.uk
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.04
Fixed in: (no value)



Subject: Would like to set Term::ReadLine prompt and ornaments
I want to define my own prompt and ornaments for Term::ReadLine. I currently do this by overriding Application::read_cmd with a modified copy of the distributed version. Perhaps it would be possible for the new method to accept a Term::ReadLine object defined by the programmer?
On Sat Apr 24 06:03:49 2010, ghewson wrote: Show quoted text
> I want to define my own prompt and ornaments for Term::ReadLine. I > currently do this by overriding Application::read_cmd with a modified > copy of the distributed version. > > Perhaps it would be possible for the new method to accept a > Term::ReadLine object defined by the programmer?
Overriding read_cmd() is the intended way to allow users to customize the way input is read, including prompting, etc. (perhaps even using something other than Term::ReadLine). This is consistent with the way other default behaviors are changed (e.g. subclass hooks like render()). I want to avoid adding options like this to the constructor, keeping the API from becoming overcomplicated and having options for special cases that usually don't apply. However, I understand that overriding read_cmd() with a slightly-modified copy of the CLIF code feels a bit awkward. If you find yourself doing it in multiple apps, you could build a "local superclass" of CLI::Framework::Application that has the overridden read_cmd(). What do you think about something like "CLI::Framework::Application::Console" (or maybe "::ReadLine") -- a specialized version that would offer richer console-specific features? It could support an arg for a prompting character or a readline object. What else might you like to see in such a class?
From: ghewson [...] wormhole.me.uk
On Tue Apr 27 13:10:28 2010, KERISMAN wrote: Show quoted text
> What do you think about something like > "CLI::Framework::Application::Console" (or maybe "::ReadLine") -- a > specialized version that would offer richer console-specific
features? Show quoted text
> It could support an arg for a prompting character or a readline
object. Show quoted text
> What else might you like to see in such a class?
That looks like a good way to go. When CLIF supports command line completion, I'd like to extend that into the application, so the application can fill out parameters that it knows about and CLIF doesn't. I haven't looked in detail at Term::ReadLine to see what's involved, but I would hope that this CLIF module would support, or at least not hinder, this application-level command line completion.