Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit f7ae784

Browse files
committed
feat: add file option to cli
Since its not allways convinient to read from stdin an option to read from file is added. Closes #451
1 parent 3eb5aa0 commit f7ae784

File tree

3 files changed

+111
-110
lines changed

3 files changed

+111
-110
lines changed

Diff for: cli.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@ var meow = require('meow');
44

55
const cli = meow(`
66
Usage
7-
$ react2dts [--module-name <name> | --top-level-module] [--react-import <name>]
7+
$ react2dts [--module-name <name> | --top-level-module] [--react-import <name>] [--file <path>]
88
99
react2dts reads from stdin to process a file.
1010
1111
Options
1212
--module-name, --name name of the module to create
1313
--top-level-module if the created module should live in top-level
1414
--react-import name of the react-like library to import (default to react)
15+
--file the file to process instead of reading from stdin
1516
1617
Examples
1718
$ cat <some/react/component.jsx> |react2dts --module-name module-name
1819
1920
$ cat <some/react/component.jsx> |react2dts --top-level-module
20-
`, {
21+
22+
$ react2dts --top-level-module --file <some/react/component.jsx>
23+
`, {
2124
flags: {
2225
'module-name': {
2326
type: 'string',
@@ -29,6 +32,9 @@ const cli = meow(`
2932
'react-import': {
3033
type: 'string',
3134
default: 'react'
35+
},
36+
'file': {
37+
type: 'string'
3238
}
3339
}
3440
});

0 commit comments

Comments
 (0)