Skip to content

Commit c5430f9

Browse files
authoredMar 22, 2020
fix(cli): remove confusion between {keep,ignore}-existing (#413)
Closes #390
1 parent f2b2367 commit c5430f9

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed
 

‎packages/cli/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ Options:
2020
--config-file <file> specify the path of the svgr config
2121
--no-runtime-config disable runtime config (".svgrrc", ".svgo.yml", ".prettierrc")
2222
-d, --out-dir <dirname> output files into a directory
23-
--ignore-existing ignore existing files in output directory
24-
--keep-existing do not override already existing files when used with --out-dir
23+
--ignore-existing ignore existing files when used with --out-dir
2524
--ext <ext> specify a custom file extension (default: "js")
2625
--filename-case <case> specify filename case ("pascal", "kebab", "camel") (default: "pascal")
2726
--icon use "1em" as width and height

‎packages/cli/src/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ program
4848
'disable runtime config (".svgrrc", ".svgo.yml", ".prettierrc")',
4949
)
5050
.option('-d, --out-dir <dirname>', 'output files into a directory')
51-
.option('--ignore-existing', 'ignore existing files in output directory')
52-
.option('--keep-existing', 'do not override already existing files when used with --out-dir')
51+
.option('--ignore-existing', 'ignore existing files when used with --out-dir')
5352
.option('--ext <ext>', 'specify a custom file extension (default: "js")')
5453
.option(
5554
'--filename-case <case>',

‎website/src/pages/docs/cli.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ A whole directory can be processed, all SVG files (matching `.svg` or `.SVG`)
3030
are transformed into React components.
3131

3232
```sh
33-
# Usage: npx @svgr/cli [-d out-dir] [--keep-existing] [src-dir]
33+
# Usage: npx @svgr/cli [-d out-dir] [--ignore-existing] [src-dir]
3434
$ npx @svgr/cli -d icons icons
3535
icons/web/clock-icon.svg -> icons/web/ClockIcon.js
3636
icons/web/wifi-icon.svg -> icons/web/WifiIcon.js
3737
icons/spinner/cog-icon.svg -> icons/spinner/CogIcon.js
3838
icons/spinner/spinner-icon.svg -> icons/spinner/SpinnerIcon.js
3939
```
4040

41-
> Add `--keep-existing` to avoid overriding existing files.
41+
> Add `--ignore-existing` to avoid overriding existing files.
4242
4343
### Use stdin
4444

‎website/src/pages/docs/options.mdx

+9-10
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ Add props to the root SVG tag.
145145
Add title tag via title property. If titleProp is set to true and no title is provided (`title={undefined}`) at render time, this will
146146
fallback to existing title element in the svg if exists.
147147

148-
| Default | CLI Override | API Override |
149-
| ------- | ------------ | ------------------- |
148+
| Default | CLI Override | API Override |
149+
| ------- | -------------- | ------------------- |
150150
| `false` | `--title-prop` | `titleProp: <bool>` |
151151

152152
## Template
@@ -170,15 +170,14 @@ Output files into a directory.
170170

171171
Specify a template function (API) to change default index.js output (when --out-dir is used).
172172

173-
| Default | CLI Override | API Override |
174-
| ------------------ | ------------------ | -------------------------- |
173+
| Default | CLI Override | API Override |
174+
| ------------------------------------------------------------------------------------------------ | ------------------ | -------------------------- |
175175
| [`basic template`](https://github.com/gregberge/svgr/blob/master/packages/cli/src/dirCommand.js) | `--index-template` | indexTemplate: files => '' |
176176

177+
## Ignore existing
177178

178-
## Keep existing
179+
When used with `--out-dir`, it ignores already existing files.
179180

180-
When used with `--out-dir`, it does not override already existing files.
181-
182-
| Default | CLI Override | API Override |
183-
| ------- | ----------------- | --------------------- |
184-
| `false` | `--keep-existing` | Only available in CLI |
181+
| Default | CLI Override | API Override |
182+
| ------- | ------------------- | --------------------- |
183+
| `false` | `--ignore-existing` | Only available in CLI |

1 commit comments

Comments
 (1)
Please sign in to comment.