2.1.6 • Published 13 days ago

@inquirer/editor v2.1.6

Weekly downloads
6
License
MIT
Repository
github
Last release
13 days ago

@inquirer/editor

Prompt that'll open the user preferred editor with default content and allow for a convenient multi-line input controlled through the command line.

Installation

npm install @inquirer/editor

yarn add @inquirer/editor

Usage

import editor from '@inquirer/editor';

const answer = await editor({
  message: 'Enter a description',
});

Options

PropertyTypeRequiredDescription
messagestringyesThe question to ask
defaultstringnoDefault value which will automatically be present in the editor
validatestring => boolean \| string \| Promise<string \| boolean>noOn submit, validate the content. When returning a string, it'll be used as the error message displayed to the user. Note: returning a rejected promise, we'll assume a code error happened and crash.
postfixstringno (default to .txt)The postfix of the file being edited. Adding this will add color highlighting to the file content in most editors.
waitForUseInputbooleanno (default to true)Open the editor automatically without waiting for the user to press enter. Note that this mean the user will not see the question! So make sure you have a default value that provide guidance if it's unclear what input is expected.
themeSee ThemingnoCustomize look of the prompt.

Theming

You can theme a prompt by passing a theme object option. The theme object only need to includes the keys you wish to modify, we'll fallback on the defaults for the rest.

type Theme = {
  prefix: string;
  spinner: {
    interval: number;
    frames: string[];
  };
  style: {
    message: (text: string) => string;
    error: (text: string) => string;
    help: (text: string) => string;
    key: (text: string) => string;
  };
};

License

Copyright (c) 2023 Simon Boudrias (twitter: @vaxilart) Licensed under the MIT license.

2.1.6

13 days ago

2.1.5

23 days ago

2.1.4

27 days ago

2.1.3

27 days ago

2.1.2

1 month ago

2.1.1

1 month ago

2.1.0

2 months ago

2.0.2

2 months ago

2.0.1

2 months ago

2.0.0

3 months ago

1.2.14

3 months ago

1.2.15

3 months ago

1.2.8

9 months ago

1.2.7

9 months ago

1.2.6

9 months ago

1.2.5

10 months ago

1.2.4

10 months ago

1.2.3

10 months ago

1.2.2

10 months ago

1.2.9

8 months ago

1.2.12

7 months ago

1.2.13

6 months ago

1.2.10

8 months ago

1.2.11

8 months ago

1.2.1

11 months ago

1.2.0

11 months ago

1.0.2

1 year ago

1.1.0

11 months ago

1.0.1

1 year ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.4

12 months ago

1.0.3

1 year ago

1.0.11

12 months ago

1.0.10

12 months ago

1.0.0

1 year ago

0.1.0

1 year ago

0.0.21-alpha.0

2 years ago

0.0.19-alpha.0

2 years ago

0.0.20-alpha.0

2 years ago

0.0.17-alpha.0

2 years ago

0.0.15-alpha.0

2 years ago

0.0.16-alpha.0

2 years ago

0.0.14-alpha.0

2 years ago

0.0.12-alpha.0

2 years ago

0.0.13-alpha.0

2 years ago

0.0.11-alpha.0

2 years ago

0.0.10-alpha.0

3 years ago

0.0.9-alpha.0

3 years ago

0.0.8-alpha.0

3 years ago

0.0.7-alpha.0

3 years ago

0.0.6-alpha.0

4 years ago

0.0.5-alpha.0

4 years ago

0.0.4-alpha.0

4 years ago

0.0.3-alpha.0

4 years ago

0.0.2-alpha.0

4 years ago