poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: poke prompt by default


From: Mohammad-Reza Nabipoor
Subject: Re: poke prompt by default
Date: Sat, 25 Nov 2023 18:45:10 +0100

Hi Jose.

On Wed, Nov 22, 2023 at 05:15:47PM +0100, Jose E. Marchesi wrote:
> 
> I would like to avoid introducing more dot-commands as much as possible.
> 


That's very good!


> IMO what you suggest (hooks and all) is way more complicated than
> providing a prompt function that handles a format string:
> 
>   var pk_prompt_format = "(%e:%i)";
> 
>   fun pk_prompt_default = string:
>   {
>     /* ... form prompt using pk_prompt_format and retur it ... */
>   }
> 
>   fun pk_prompt = string:
>   {
>     return pk_prompt_default;
>   }
> 
> So we would document:
> 
> 1. poke will call the pk_prompt function (which has ()string signature)
>    in order to get a string with the prompt, every time it needs one.
> 
> 2. The default definition of pk_prompt uses the format string in
>    pk_prompt_format in order to format a prompt string, then returns it.
>    Supported tags are %e, %i, etc.
> 
> 3. You can use your own definition of pk_prompt just by re-defining it.
>    Any function is good provided it returns a string.  You can call
>    pk_prompt_default (which uses the global format string) from your
>    new definition of pk_prompt.
> 
> That is all Poke, no need for dot-commands.
> The question is: is it worth it?
> 


IMHO we can just implement a few pk_prompt_* functions, and document them
and tell the user that by re-defining the `pk_prompt' function, they can
use one of them (simple short copy-pastable code snippet).
That's better than having this `pk_prompt_format'.


Regards,
Mohammad-Reza



reply via email to

[Prev in Thread] Current Thread [Next in Thread]