Skip to content

Commit d4926af

Browse files
committed
Change name to go-replace
1 parent e58ca9c commit d4926af

File tree

4 files changed

+49
-49
lines changed

4 files changed

+49
-49
lines changed

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func handleSpecialCliOptions(args []string) ([]string) {
243243

244244
// --version
245245
if (opts.ShowVersion) {
246-
fmt.Println(fmt.Sprintf("goreplace version %s", Version))
246+
fmt.Println(fmt.Sprintf("go-replace version %s", Version))
247247
fmt.Println(fmt.Sprintf("Copyright (C) 2017 %s", Author))
248248
os.Exit(0)
249249
}

tests/lineinfile.test

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ Go Lineinfile tests:
22

33
$ CURRENT="$(pwd)"
44
$ cd "$TESTDIR/../"
5-
$ go build -o goreplace
5+
$ go build -o go-replace
66
$ cd "$CURRENT"
7-
$ alias goreplace="$TESTDIR/../goreplace"
7+
$ alias go-replace="$TESTDIR/../go-replace"
88

99
Exec test:
1010

11-
$ goreplace -h > /dev/null
11+
$ go-replace -h > /dev/null
1212
[1]
1313

1414

@@ -20,7 +20,7 @@ Testing lineinfile mode:
2020
> this is the third foobar line
2121
> this is the last line
2222
> EOF
23-
$ goreplace --mode=lineinfile -s foobar -r ___xxx test.txt
23+
$ go-replace --mode=lineinfile -s foobar -r ___xxx test.txt
2424
$ cat test.txt
2525
this is a testline
2626
this is the second line
@@ -36,7 +36,7 @@ Testing lineinfile mode with multiple matches:
3636
> this is the foobar forth foobar line
3737
> this is the last line
3838
> EOF
39-
$ goreplace --mode=lineinfile -s foobar -r ___xxx test.txt
39+
$ go-replace --mode=lineinfile -s foobar -r ___xxx test.txt
4040
$ cat test.txt
4141
this is a testline
4242
this is the second line
@@ -53,7 +53,7 @@ Testing lineinfile mode with multiple matches and --once:
5353
> this is the foobar forth foobar line
5454
> this is the last line
5555
> EOF
56-
$ goreplace --mode=lineinfile -s foobar -r ___xxx --once test.txt
56+
$ go-replace --mode=lineinfile -s foobar -r ___xxx --once test.txt
5757
$ cat test.txt
5858
this is a testline
5959
this is the second line
@@ -70,7 +70,7 @@ Testing lineinfile mode with multiple matches and --once=unique:
7070
> this is the foobar forth foobar line
7171
> this is the last line
7272
> EOF
73-
$ goreplace --mode=lineinfile -s foobar -r ___xxx --once=unique test.txt
73+
$ go-replace --mode=lineinfile -s foobar -r ___xxx --once=unique test.txt
7474
$ cat test.txt
7575
this is a testline
7676
this is the second line
@@ -86,7 +86,7 @@ Testing lineinfile mode without match:
8686
> this is the foobar forth foobar line
8787
> this is the last line
8888
> EOF
89-
$ goreplace --mode=lineinfile -s barfoo -r ___xxx --once=unique test.txt
89+
$ go-replace --mode=lineinfile -s barfoo -r ___xxx --once=unique test.txt
9090
$ cat test.txt
9191
this is a testline
9292
this is the second line
@@ -103,13 +103,13 @@ Testing lineinfile mode with regex:
103103
> this is the third foobar line
104104
> this is the last line
105105
> EOF
106-
$ goreplace --mode=lineinfile --regex --regex-backrefs -s 'f[o]+(b[a]*r)' -r '___$1' test.txt
106+
$ go-replace --mode=lineinfile --regex --regex-backrefs -s 'f[o]+(b[a]*r)' -r '___$1' test.txt
107107
$ cat test.txt
108108
this is a testline
109109
this is the second line
110110
___bar
111111
this is the last line
112-
$ goreplace --mode=lineinfile --regex --regex-backrefs -s 'not-existing-line' -r '___$1' test.txt
112+
$ go-replace --mode=lineinfile --regex --regex-backrefs -s 'not-existing-line' -r '___$1' test.txt
113113
$ cat test.txt
114114
this is a testline
115115
this is the second line
@@ -126,7 +126,7 @@ Testing lineinfile mode with lineinfile-before:
126126
> this is the third foobar line
127127
> this is the last line
128128
> EOF
129-
$ goreplace --mode=lineinfile --lineinfile-before="#global#" -s 'notexisting' -r 'example=foobar' test.txt
129+
$ go-replace --mode=lineinfile --lineinfile-before="#global#" -s 'notexisting' -r 'example=foobar' test.txt
130130
$ cat test.txt
131131
this is a testline
132132
example=foobar
@@ -144,7 +144,7 @@ Testing lineinfile mode with lineinfile-after:
144144
> this is the third foobar line
145145
> this is the last line
146146
> EOF
147-
$ goreplace --mode=lineinfile --lineinfile-after="#global#" -s 'notexisting' -r 'example=foobar' test.txt
147+
$ go-replace --mode=lineinfile --lineinfile-after="#global#" -s 'notexisting' -r 'example=foobar' test.txt
148148
$ cat test.txt
149149
this is a testline
150150
#global#

tests/main.test

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@ Go Replace tests:
22

33
$ CURRENT="$(pwd)"
44
$ cd "$TESTDIR/../"
5-
$ go build -o goreplace
5+
$ go build -o go-replace
66
$ cd "$CURRENT"
7-
$ alias goreplace="$TESTDIR/../goreplace"
7+
$ alias go-replace="$TESTDIR/../go-replace"
88

99
Usage:
1010

11-
$ goreplace -h > /dev/null
11+
$ go-replace -h > /dev/null
1212
[1]
13-
$ goreplace -V
14-
goreplace version [0-9]+.[0-9]+.[0-9]+ (re)
13+
$ go-replace -V
14+
go-replace version [0-9]+.[0-9]+.[0-9]+ (re)
1515
Copyright \(C\) 20[0-9]{2} webdevops.io (re)
16-
$ goreplace --dumpversion
16+
$ go-replace --dumpversion
1717
[0-9]+.[0-9]+.[0-9]+ (re)
1818

1919

2020
Testing ignoring missing arguments:
2121

22-
$ goreplace -s foobar -r ___xxx --ignore-empty
22+
$ go-replace -s foobar -r ___xxx --ignore-empty
2323

2424
Testing missing search and replace argument:
2525

26-
$ goreplace --mode=replace /dev/null
26+
$ go-replace --mode=replace /dev/null
2727
Error: Missing either --search or --replace for this mode
2828
Command: .* (re)
2929
[1]
3030

3131
Testing ignoring missing arguments in template mode:
3232

33-
$ goreplace --mode=template --ignore-empty
33+
$ go-replace --mode=template --ignore-empty
3434

3535

3636

@@ -42,7 +42,7 @@ Testing replace mode:
4242
> this is the third foobar line
4343
> this is the last line
4444
> EOF
45-
$ goreplace -s foobar -r ___xxx test.txt
45+
$ go-replace -s foobar -r ___xxx test.txt
4646
$ cat test.txt
4747
this is a testline
4848
this is the second line
@@ -57,7 +57,7 @@ Testing replace mode with multiple changesets:
5757
> this is the third foobar line
5858
> this is the last oofrab line
5959
> EOF
60-
$ goreplace -s foobar -r 111 -s barfoo -r 222 -s oofrab -r 333 test.txt
60+
$ go-replace -s foobar -r 111 -s barfoo -r 222 -s oofrab -r 333 test.txt
6161
$ cat test.txt
6262
this is a testline
6363
this is the second 222 line
@@ -72,7 +72,7 @@ Testing replace mode with stdin:
7272
> this is the third foobar line
7373
> this is the last line
7474
> EOF
75-
$ cat test.txt | goreplace -s foobar -r ___xxx --stdin
75+
$ cat test.txt | go-replace -s foobar -r ___xxx --stdin
7676
this is a testline
7777
this is the second line
7878
this is the third ___xxx line
@@ -87,7 +87,7 @@ Testing replace mode with multiple matches:
8787
> this is the foobar forth foobar line
8888
> this is the last line
8989
> EOF
90-
$ goreplace -s foobar -r ___xxx test.txt
90+
$ go-replace -s foobar -r ___xxx test.txt
9191
$ cat test.txt
9292
this is a testline
9393
this is the second line
@@ -104,7 +104,7 @@ Testing replace mode without match:
104104
> this is the foobar forth foobar line
105105
> this is the last line
106106
> EOF
107-
$ goreplace -s barfoo -r ___xxx test.txt
107+
$ go-replace -s barfoo -r ___xxx test.txt
108108
$ cat test.txt
109109
this is a testline
110110
this is the second line
@@ -120,7 +120,7 @@ Testing replace mode with regex:
120120
> this is the third foobar line
121121
> this is the last line
122122
> EOF
123-
$ goreplace --regex -s 'f[o]+b[a]*r' -r ___xxx test.txt
123+
$ go-replace --regex -s 'f[o]+b[a]*r' -r ___xxx test.txt
124124
$ cat test.txt
125125
this is a testline
126126
this is the second line
@@ -135,13 +135,13 @@ Testing replace mode with regex:
135135
> this is the third foobar line
136136
> this is the last line
137137
> EOF
138-
$ goreplace --regex --regex-backrefs -s 'f[o]+(b[a]*r)' -r '___$1' test.txt
138+
$ go-replace --regex --regex-backrefs -s 'f[o]+(b[a]*r)' -r '___$1' test.txt
139139
$ cat test.txt
140140
this is a testline
141141
this is the second line
142142
this is the third ___bar line
143143
this is the last line
144-
$ goreplace --regex --regex-backrefs -s 'not-existing-line' -r '___$1' test.txt
144+
$ go-replace --regex --regex-backrefs -s 'not-existing-line' -r '___$1' test.txt
145145
$ cat test.txt
146146
this is a testline
147147
this is the second line
@@ -156,7 +156,7 @@ Testing replace mode with regex and case-insensitive:
156156
> this is the third foobar line
157157
> this is the last line
158158
> EOF
159-
$ goreplace --regex --regex-backrefs -s 'F[O]+(b[a]*r)' -r '___$1' --case-insensitive test.txt
159+
$ go-replace --regex --regex-backrefs -s 'F[O]+(b[a]*r)' -r '___$1' --case-insensitive test.txt
160160
$ cat test.txt
161161
this is a testline
162162
this is the second line
@@ -172,7 +172,7 @@ Testing line mode:
172172
> this is the third foobar line
173173
> this is the last line
174174
> EOF
175-
$ goreplace --mode=line -s foobar -r ___xxx test.txt
175+
$ go-replace --mode=line -s foobar -r ___xxx test.txt
176176
$ cat test.txt
177177
this is a testline
178178
this is the second line
@@ -188,7 +188,7 @@ Testing line mode with multiple matches:
188188
> this is the foobar forth foobar line
189189
> this is the last line
190190
> EOF
191-
$ goreplace --mode=line -s foobar -r ___xxx test.txt
191+
$ go-replace --mode=line -s foobar -r ___xxx test.txt
192192
$ cat test.txt
193193
this is a testline
194194
this is the second line
@@ -205,7 +205,7 @@ Testing line mode with multiple matches and --once:
205205
> this is the foobar forth foobar line
206206
> this is the last line
207207
> EOF
208-
$ goreplace --mode=line -s foobar -r ___xxx --once test.txt
208+
$ go-replace --mode=line -s foobar -r ___xxx --once test.txt
209209
$ cat test.txt
210210
this is a testline
211211
this is the second line
@@ -222,7 +222,7 @@ Testing line mode with multiple matches and --once=unique:
222222
> this is the foobar forth foobar line
223223
> this is the last line
224224
> EOF
225-
$ goreplace --mode=line -s foobar -r ___xxx --once=unique test.txt
225+
$ go-replace --mode=line -s foobar -r ___xxx --once=unique test.txt
226226
$ cat test.txt
227227
this is a testline
228228
this is the second line
@@ -245,7 +245,7 @@ Testing replace mode with path option:
245245
$ cp test.txt testing/sub2/subsub/test4.txt
246246
$ cp test.txt testing/sub2/subsub/test5.txt
247247
$ cp test.txt testing/sub2/original.md
248-
$ goreplace -s foobar -r barfoo --path=./testing --path-pattern='*.txt'
248+
$ go-replace -s foobar -r barfoo --path=./testing --path-pattern='*.txt'
249249
$ cat testing/sub1/subsub/test1.txt
250250
this is a testline
251251
this is the second line
@@ -293,7 +293,7 @@ Testing with --output:
293293
> this is the third foobar line
294294
> this is the last line
295295
> EOF
296-
$ goreplace -s foobar -r ___xxx test.txt --output test.output
296+
$ go-replace -s foobar -r ___xxx test.txt --output test.output
297297
$ cat test.output
298298
this is a testline
299299
this is the second line
@@ -309,7 +309,7 @@ Testing with --output but multiple arguments:
309309
> this is the last line
310310
> EOF
311311
$ cp test.txt test2.txt
312-
$ goreplace -s foobar -r ___xxx test.txt test2.txt --output test.output
312+
$ go-replace -s foobar -r ___xxx test.txt test2.txt --output test.output
313313
Error: Only one file is allowed when using --output
314314
Command: .* (re)
315315
[1]
@@ -322,7 +322,7 @@ Testing with source:dest:
322322
> this is the third foobar line
323323
> this is the last line
324324
> EOF
325-
$ goreplace -s foobar -r ___xxx test.txt:test.output
325+
$ go-replace -s foobar -r ___xxx test.txt:test.output
326326
$ cat test.output
327327
this is a testline
328328
this is the second line

tests/template.test

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ Go Replace tests:
22

33
$ CURRENT="$(pwd)"
44
$ cd "$TESTDIR/../"
5-
$ go build -o goreplace
5+
$ go build -o go-replace
66
$ cd "$CURRENT"
7-
$ alias goreplace="$TESTDIR/../goreplace"
7+
$ alias go-replace="$TESTDIR/../go-replace"
88

99
Exec test:
1010

11-
$ goreplace -h > /dev/null
11+
$ go-replace -h > /dev/null
1212
[1]
1313

1414

@@ -22,7 +22,7 @@ Testing template mode:
2222
> this is the third foobar line
2323
> this is the last line
2424
> EOF
25-
$ goreplace --mode=template -s Foobar -r ___xxx test.txt
25+
$ go-replace --mode=template -s Foobar -r ___xxx test.txt
2626
$ cat test.txt
2727
23<45
2828
___xxx
@@ -41,7 +41,7 @@ Testing template mode with only env:
4141
> this is the third foobar line
4242
> this is the last line
4343
> EOF
44-
$ Foobar=barfoo goreplace --mode=template test.txt
44+
$ Foobar=barfoo go-replace --mode=template test.txt
4545
$ cat test.txt
4646
23<45
4747
barfoo
@@ -60,7 +60,7 @@ Testing template mode with only env and empty var:
6060
> this is the third foobar line
6161
> this is the last line
6262
> EOF
63-
$ Foobar= goreplace --mode=template test.txt
63+
$ Foobar= go-replace --mode=template test.txt
6464
$ cat test.txt
6565
23<45
6666
beginend
@@ -80,7 +80,7 @@ Testing template mode with only env and empty var:
8080
> this is the third foobar line
8181
> this is the last line
8282
> EOF
83-
$ Foobar="bar=foo" goreplace --mode=template test.txt
83+
$ Foobar="bar=foo" go-replace --mode=template test.txt
8484
$ cat test.txt
8585
23<45
8686
bar=foo
@@ -99,7 +99,7 @@ Testing template mode with stdin:
9999
> this is the third foobar line
100100
> this is the last line
101101
> EOF
102-
$ cat test.txt | goreplace --mode=template --stdin -s Foobar -r ___xxx
102+
$ cat test.txt | go-replace --mode=template --stdin -s Foobar -r ___xxx
103103
23<45
104104
___xxx
105105
this is a testline
@@ -117,7 +117,7 @@ Testing template mode with stdin:
117117
> this is the third foobar line
118118
> this is the last line
119119
> EOF
120-
$ goreplace --mode=template -s Foobar -r ___xxx --output-strip-ext=.tmpl test.txt.tmpl
120+
$ go-replace --mode=template -s Foobar -r ___xxx --output-strip-ext=.tmpl test.txt.tmpl
121121
$ cat test.txt
122122
23<45
123123
___xxx
@@ -132,7 +132,7 @@ Testing template with functions:
132132
> {{env "FOO"}}
133133
> {{env "bar"}}
134134
> EOF
135-
$ FOO=bar bar=FOO goreplace --mode=template -s Foobar -r ___xxx test.txt
135+
$ FOO=bar bar=FOO go-replace --mode=template -s Foobar -r ___xxx test.txt
136136
$ cat test.txt
137137
bar
138138
FOO

0 commit comments

Comments
 (0)