A light weight CLI tool designed to make developers more robust in refactoring large codebase.
- Change extensions of multiple files with just one command
- Rename multiple files much more faster than the traditional way
- Rename multiple directories
🧪Refactor is in it's early stages and it is strictly experimental. Your contributions and suggestions are more than welcome
To install this CLI using npm run;
npm install refactor -g
This will install the CLI and make it globally available.
There are currently two main commands. One comes with several options which enables you two perform more sophisticated tasks.
Command | Description |
---|---|
about | Prints general info about the CLI unto the console |
rename | This one does the magic. It takes in different arguments depending on the sort of operation you want to perform |
help | Use this command whenever you forget the two other commands |
You can use the about command as so;
refactor about
This general info about the CLI unto the console.
The rename command takes the following form.
refactor rename --[arg1] --[arg2] --[etc]
The arguments are as followed
-
--path: The path to the directory of operation. This argument is always demanded.
Example usage:
refactor rename --path="."
type: string | required: true -
--file: Consider this argument as toggler. Set it to true if you want to perform the operation on files, false if directories.
Example usage:
refactor rename --path="." --file=true
type: string | required: true -
fromExt: The file extension you want to change. Used alongside --toExt argument.
Example usage:
refactor rename --path="." --file=true --fromExt="js" --toExt="ts"
type: string | required: if --file is set to true -
toExt: The final extension you want for your files. Used alongside --fromExt argument.
Example usage:
refactor rename --path="." --file=true --fromExt="js" --toExt="ts"
type: string | required: if --file is set to true -
exclude: Use this argument incase you have some files you want to exclude from the operation.
Example usage:
refactor rename --path="." --file=true --fromExt="js" --toExt="ts" --exclude="a.js, b.js, c.js"