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: Wed, 22 Nov 2023 00:58:45 +0100

Hi Jose.

On Tue, Nov 21, 2023 at 05:24:48PM +0100, Jose E. Marchesi wrote:
> 
> I wonder:
> 
> 1. It is easy for the user to write her own pk_prompt function, that may
>    be as complex as desired.  However, the default version of the
>    function may use the typical "format string" featuring predefined
>    tags, such as "(%e:%i)" where %e is replaced by the current
>    endianness and %i with the selected IO space or "poke" if no IO
>    space.  This could ease a bit customizing prompts, but it would
>    require documentation etc.  The question is: would supporting this be
>    worth the effort and maintenance?
> 

TL;DR:  We should use Poke. We can provide more prompts in Poke.


I disagree with introduing "format string" or other kind of DSL beside the
Poke.
Instead we can implement a bunch of different pk_prompt functions with different
options/styles, which (1) can be a source of inspiration for the users and
(2) easier to maintain and fix for us.

We can also help the user by providing a dot-command to cycle through these
different prompts.  Example:

```
(poke) .set prompt
fixed-string
endian-filename
...
```

Then, to select the prompt:

```
.set prompt fixed-string
```

To change that string:

```
.set prompt fixed-string "#!poke!#"
```

which will run `pk_prompt_fixed_string = "#!poke!#";' statement.

Easy for user to customize, easier to implement.

I'm not sure about the details of to organize the dot-command, but
supporting an array of default functions and choosing an index to select
the default prompt is easy using just Poke (no dot command).

We also provide user with hooks to register functions for prompt.


> 2. Is the default prompt the right default?  We are usually very
>    conservative with defaults (no pretty-printing, plain output mode,
>    etc) and that may give people the impression that poke is much more
>    limited that it actually is.  Should we have a default like mine?
> 


Other than pretty-printing (which can be confusing for the new user), yes.
I think we can improve the user experience by exposing more features.


Regards,
Mohammad-Reza



reply via email to

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