You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varyargs=require('yargs').strict().usage('RexReplace '+version+': Regexp search and replace for files using lookahead and backreference to matching groups in the replacement. Defaults to global multiline case-insensitive search.\n\n> rexreplace searchFor replaceWith filename').example("> rexreplace '(f?(o))o(.*)' '$3$1$2' myfile.md","'foobar' in myfile.md will become 'barfoo'").example('').example("> rexreplace -I 'Foo' 'xxx' myfile.md","'foobar' in myfile.md will remain 'foobar'").example('').example('> rexreplace \'^#\' \'##\' *.md','All markdown files in this dir got all headlines moved one level deeper').version('v','Echo rexreplace version',version).alias('v','version').boolean('I').describe('I','Void case insensitive search pattern.').alias('I','void-ignore-case').boolean('M').describe('M','Void multiline search pattern. Makes ^ and $ match start/end of whole content rather than each line.').alias('M','void-multiline').boolean('u').describe('u','Treat pattern as a sequence of unicode code points.').alias('u','unicode').describe('e','Encoding of files.').alias('e','encoding').default('e','utf8').boolean('o').describe('o','Output the result instead of saving to file. Will also output content even if no replacement have taken place.').alias('o','output')
11
27
//.conflicts('o', 'd')
12
28
@@ -60,13 +76,13 @@ var args = yargs.argv;
60
76
61
77
debug(args);
62
78
63
-
if(args._.length<3){
64
-
die('Need more than 2 arguments',args._.length+' was found',true);
79
+
if(helpAndDie){
80
+
die('Need both pattern and replacement as arguments',true);
0 commit comments