Skip to content

Commit

Permalink
add new options to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
UnrefinedBrain committed Sep 30, 2024
1 parent c872204 commit 6e0361a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/guide/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ vue-metamorph provides a CLI codemod runner to faciliate running codemods agains
| Option | Description | Default |
| - | - | - |
| --help | Print available options | N/A |
| --list-plugins | Lists all registered plugins and exists | N/A |
| --files <glob> | Run transforms against these files using a [glob](https://www.npmjs.com/package/glob) pattern | `'**/src/**/*'` |
| --plugins <glob> | Only run plugins matching these [micromatch](https://github.com/micromatch/micromatch) patterns. This option can be passed multiple times to specify multiple patterns | `'*'` |

## API

Expand Down Expand Up @@ -54,9 +56,11 @@ Options will be passed to the CodemodPlugin `transform()` and ManualMigrationPlu
const myCodemod: CodemodPlugin = {
name: 'myCodemod',
type: 'codemod',
transform(scriptASTs, sfcAST, filename, utils, opts) {
transform({ opts }) {
if (opts.myCustomOption) {
// behave differently
// do something
} else {
// do something else
}
}
}
Expand Down

0 comments on commit 6e0361a

Please sign in to comment.