Closed brianweil closed 8 years ago
I wonder if we could call the system editor like when you git commit
and get the content back afterward.
+1. karma init does this reasonably well
This would be great for doing things like blog posts from the command-line. Hexo would do well to integrate this.
Just to make sure this stays on the radar: +1
+1 Any updates on this? I support the Shift
+Enter
idea, either as a default to insert newline on any option, or swapped for Enter
behavior which instead inserts newline on options explicitly configured as multiline.
@adjohnson916 PR welcomed.
This is now shipped with v1.1.0
I know there is editor support, but is there any chance that you will also support multiline? I prefer would prefer multiline over editor for my application.
Multiline should allow the user to enter multiple lines, and close when it encounters an empty line (or line with only a dot) or when the user presses CTRL+D. At least that is the standard behaviour across various command line applications I use.
I tried to look at your code to implement it myself, but I don't really understand how to implement a custom prompt... Is there any documentation or tutorial?
A working (yet untested) implementation: https://github.com/aleclarson/inquirer/commit/16ddf2f497ca7b0929ba252eef875062eebd5e64
It adds a multiline
boolean option to input
prompts. It probably won't merge cleanly into master, because I've made other changes. But you can take inspiration from it.
The ctrl+d
key binding has its own commit: https://github.com/aleclarson/inquirer/commit/e5c844e9ab056e3b17eef94ae05dc211d0656275
Has this feature been merged? I don't see how to receive multi-line input from the user from terminal without opening external windows.
import { input } from '@inquirer/prompts';
const answer = await input({
message: 'Enter a description',
multiline: true,
});
console.log(answer);
I tried this, but it only accepted one line. Also I don't see anything about multiline support in the homepage: https://github.com/SBoudrias/Inquirer.js
I think this issue can be reopened to track the interest in this request.
Hi @KoStard, the multi-line comes through the editor
prompt. There's been some more recent talk over here too https://github.com/SBoudrias/Inquirer.js/discussions/1583 (I'm open to improving this, but transparently, it's not on my todo list ATM. So it's up for the taking.)
I would like to add support for multiple lines of text in the input type. I use the prompt for commit messages and sometimes one line is not enough. The UI could be as simple as pressing shift+enter to move to the next line of input. Feedback from the contributors is welcome and appreciated.