Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] use clack text to develop a cli supporting command history #186

Closed
bsorrentino opened this issue Jan 21, 2024 · 1 comment
Closed
Labels
enhancement New feature or request

Comments

@bsorrentino
Copy link

Develop a Cli application managing a command history

In order to use Text input to develop a CLI like application we need to call a text() inside a loop where the workflow is:

  1. submit command
  2. exec command
  3. wait for another command
  4. repeat until user cancel input

Problem 1 : Manage Up / Down

Using the standard text function I can't set cursor event handler to manage Up/Down key. It would be great to have another function (eg const textPrompt = (opts: TextOptions): TextPrompt) that return the underlyend customised TextPrompt

Problem 2: Rewrite prompt buffer

Currently the rl:ReadLiner property Prompt is private and I can't rewrite prompt value with command history. I would be great have a method allowing such rewrite

@bsorrentino bsorrentino added the enhancement New feature or request label Jan 21, 2024
@github-project-automation github-project-automation bot moved this to Needs triage in Triage Board Dec 29, 2024
@natemoo-re
Copy link
Member

Hey, thanks for opening an issue! I'm finally working through the backlog here.

Generally would not recommend using the text() prompt for a use case like this since dropping down to the raw node:readline APIs would give you a lot more control. It even supports a history event and passing a custom history to the interface.

However, it would be interesting if Clack prompts managed their own history... I'm going to open a new issue to track that idea.

@natemoo-re natemoo-re closed this as not planned Won't fix, can't repro, duplicate, stale Jan 4, 2025
@natemoo-re natemoo-re moved this from Needs triage to Done in Triage Board Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

2 participants