regex-replace
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -5,2 +5,3 @@ #!/usr/bin/env node | ||
const replace = require('replace'); | ||
const packageJson = require('./package.json'); | ||
@@ -96,2 +97,3 @@ const walkAsync = (path) => { | ||
const [ cmd, cmdFile, searchString, replaceString, path, ...options ] = argv; | ||
const isVersionFlag = (argv[2] === '-v'); | ||
@@ -118,8 +120,10 @@ const customOptions = options.reduce((acc, value, key) => { | ||
if(searchString && replaceString && path) { | ||
if((searchString && replaceString && path) && !isVersionFlag) { | ||
regexReplace(searchString, replaceString, path, customOptions); | ||
} else { | ||
} else if (!isVersionFlag){ | ||
console.error('missing required arguments: (<searchString>, <replaceString>, <path>, [options])'); | ||
} else if(isVersionFlag) { | ||
console.log(packageJson.version); | ||
} | ||
module.exports = regexReplace; |
{ | ||
"name": "regex-replace", | ||
"author": "Don Mclean", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "A simple CLI/Module for regex replacing strings in files & renaming files recursively", | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
# regex-replace | ||
A simple CLI/Module for regex replacing strings in files & renaming files recursively | ||
[](https://www.npmjs.com/package/regex-replace) [](https://travis-ci.org/Donmclean/regex-replace) [](https://github.com/Donmclean/riko/blob/master/LICENSE) | ||
[](https://www.npmjs.com/package/regex-replace) [](https://travis-ci.org/Donmclean/regex-replace) [](https://github.com/Donmclean/riko/blob/master/LICENSE) | ||
@@ -32,2 +32,7 @@ ## Getting Started | ||
Version | ||
```bash | ||
regex-replace -v | ||
``` | ||
###### Module Example | ||
@@ -34,0 +39,0 @@ ```javascript |
19099
192
121