Skip to content

Commit

Permalink
fix(cli): remove confusion between {keep,ignore}-existing (#413)
Browse files Browse the repository at this point in the history
Closes #390
  • Loading branch information
gregberge committed Mar 22, 2020
1 parent f2b2367 commit c5430f9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
3 changes: 1 addition & 2 deletions packages/cli/README.md
Expand Up @@ -20,8 +20,7 @@ Options:
--config-file <file> specify the path of the svgr config
--no-runtime-config disable runtime config (".svgrrc", ".svgo.yml", ".prettierrc")
-d, --out-dir <dirname> output files into a directory
--ignore-existing ignore existing files in output directory
--keep-existing do not override already existing files when used with --out-dir
--ignore-existing ignore existing files when used with --out-dir
--ext <ext> specify a custom file extension (default: "js")
--filename-case <case> specify filename case ("pascal", "kebab", "camel") (default: "pascal")
--icon use "1em" as width and height
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/src/index.js
Expand Up @@ -48,8 +48,7 @@ program
'disable runtime config (".svgrrc", ".svgo.yml", ".prettierrc")',
)
.option('-d, --out-dir <dirname>', 'output files into a directory')
.option('--ignore-existing', 'ignore existing files in output directory')
.option('--keep-existing', 'do not override already existing files when used with --out-dir')
.option('--ignore-existing', 'ignore existing files when used with --out-dir')
.option('--ext <ext>', 'specify a custom file extension (default: "js")')
.option(
'--filename-case <case>',
Expand Down
4 changes: 2 additions & 2 deletions website/src/pages/docs/cli.mdx
Expand Up @@ -30,15 +30,15 @@ A whole directory can be processed, all SVG files (matching `.svg` or `.SVG`)
are transformed into React components.

```sh
# Usage: npx @svgr/cli [-d out-dir] [--keep-existing] [src-dir]
# Usage: npx @svgr/cli [-d out-dir] [--ignore-existing] [src-dir]
$ npx @svgr/cli -d icons icons
icons/web/clock-icon.svg -> icons/web/ClockIcon.js
icons/web/wifi-icon.svg -> icons/web/WifiIcon.js
icons/spinner/cog-icon.svg -> icons/spinner/CogIcon.js
icons/spinner/spinner-icon.svg -> icons/spinner/SpinnerIcon.js
```

> Add `--keep-existing` to avoid overriding existing files.
> Add `--ignore-existing` to avoid overriding existing files.
### Use stdin

Expand Down
19 changes: 9 additions & 10 deletions website/src/pages/docs/options.mdx
Expand Up @@ -145,8 +145,8 @@ Add props to the root SVG tag.
Add title tag via title property. If titleProp is set to true and no title is provided (`title={undefined}`) at render time, this will
fallback to existing title element in the svg if exists.

| Default | CLI Override | API Override |
| ------- | ------------ | ------------------- |
| Default | CLI Override | API Override |
| ------- | -------------- | ------------------- |
| `false` | `--title-prop` | `titleProp: <bool>` |

## Template
Expand All @@ -170,15 +170,14 @@ Output files into a directory.

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

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

## Ignore existing

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

When used with `--out-dir`, it does not override already existing files.

| Default | CLI Override | API Override |
| ------- | ----------------- | --------------------- |
| `false` | `--keep-existing` | Only available in CLI |
| Default | CLI Override | API Override |
| ------- | ------------------- | --------------------- |
| `false` | `--ignore-existing` | Only available in CLI |

1 comment on commit c5430f9

@vercel
Copy link

@vercel vercel bot commented on c5430f9 Mar 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.