Skip to content

Commit 53f5126

Browse files
authored
Merge pull request #16 from hartwork/rename-executable
Rename executable
2 parents 315c202 + f434d9f commit 53f5126

File tree

8 files changed

+26
-25
lines changed

8 files changed

+26
-25
lines changed

.github/workflows/build_and_test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
- name: Build and test
2727
run: |-
2828
set -e
29-
go build .
30-
./go-wait-for-it --help
31-
./go-wait-for-it \
29+
go build ./cmd/wait-for-it
30+
./wait-for-it --help
31+
./wait-for-it \
3232
--timeout 2 \
3333
--service github.com:80 \
3434
--service github.com:443 \

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/go-wait-for-it
1+
/wait-for-it

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## About
88

9-
**go-wait-for-it** is a lookalike of
9+
**wait-for-it** is a lookalike of
1010
(the perfectly fine)
1111
Python [wait-for-it](https://github.com/clarketm/wait-for-it)
1212
written in Go 1.14+.
@@ -24,8 +24,8 @@ $ go version
2424
go version go1.14.6 linux/amd64
2525
$ go get github.com/hartwork/go-wait-for-it
2626
$ export PATH="${PATH}:$(go env GOPATH)/bin"
27-
$ go-wait-for-it --version
28-
wait-for-it 1.0.0
27+
$ wait-for-it --version
28+
wait-for-it 2.0.0
2929
```
3030

3131

@@ -35,31 +35,31 @@ wait-for-it 1.0.0
3535
$ go version
3636
go version go1.14.6 linux/amd64
3737
$ go build .
38-
$ ./go-wait-for-it --version
39-
wait-for-it 1.0.0
38+
$ ./wait-for-it --version
39+
wait-for-it 2.0.0
4040
```
4141

4242

4343
## Examples
4444

4545
```console
46-
$ ./go-wait-for-it -t 2 -s :631 -s localhost:631 -s 127.0.0.1:631 -- echo 'CUPS is available'
46+
$ wait-for-it -t 2 -s :631 -s localhost:631 -s 127.0.0.1:631 -- echo 'CUPS is very available'
4747
[*] Trying to connect to :631...
4848
[*] Trying to connect to localhost:631...
4949
[*] Trying to connect to 127.0.0.1:631...
5050
[+] Connected to 127.0.0.1:631 after 201.653µs.
5151
[+] Connected to :631 after 158.548µs.
5252
[+] Connected to localhost:631 after 381.536µs.
5353
[*] Running command: echo CUPS is available
54-
CUPS is available
54+
CUPS is very available
5555
[+] Command succeeded.
5656
```
5757

5858

5959
## Usage
6060

6161
```console
62-
$ go-wait-for-it --help
62+
$ wait-for-it --help
6363
Wait for service(s) to be available before executing a command.
6464

6565
Usage:
@@ -72,7 +72,7 @@ Flags:
7272
-t, --timeout uint timeout in seconds, 0 for no timeout (default 15)
7373
-v, --version version for wait-for-it
7474

75-
go-wait-for-it is software libre, licensed under the AGPL v3 or later license.
75+
wait-for-it is software libre, licensed under the AGPL v3 or later license.
7676
Please report bugs at https://github.com/hartwork/go-wait-for-it/issues. Thank you!
7777
```
7878

@@ -82,6 +82,7 @@ Please report bugs at https://github.com/hartwork/go-wait-for-it/issues. Thank
8282
### Go
8383

8484
- [`github.com/alioygur/wait-for`](https://github.com/alioygur/wait-for)
85+
- [`github.com/hartwork/go-wait-for-it/`](https://github.com/hartwork/go-wait-for-it/) — the one you are looking at
8586
- [`github.com/maxcnunes/waitforit`](https://github.com/maxcnunes/waitforit)
8687

8788

File renamed without changes.

main_test.go renamed to cmd/wait-for-it/main_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,45 +15,45 @@ import (
1515

1616
func TestInnerMainUsageError(t *testing.T) {
1717
testlab.WithOutputCapturing(t, func() {
18-
err := innerMain([]string{"go-wait-for-it", "--no-such-thing"})
18+
err := innerMain([]string{"wait-for-it", "--no-such-thing"})
1919
assert.NotNil(t, err)
2020
}, &os.Stderr)
2121
}
2222

2323
func TestInnerMainHelpDisplayed(t *testing.T) {
2424
testlab.WithOutputCapturing(t, func() {
25-
err := innerMain([]string{"go-wait-for-it", "--help"})
25+
err := innerMain([]string{"wait-for-it", "--help"})
2626
assert.Nil(t, err)
2727
}, &os.Stdout)
2828
}
2929

3030
func TestInnerMainTimout(t *testing.T) {
3131
network.WithUnusedPort(t, func(address network.Address) {
32-
err := innerMain([]string{"go-wait-for-it", "-q", "-t", "1", "-s", address.String()})
32+
err := innerMain([]string{"wait-for-it", "-q", "-t", "1", "-s", address.String()})
3333
assert.NotNil(t, err)
3434
})
3535
}
3636

3737
func TestInnerMainRunError(t *testing.T) {
38-
err := innerMain([]string{"go-wait-for-it", "-q", "false"})
38+
err := innerMain([]string{"wait-for-it", "-q", "false"})
3939
assert.NotNil(t, err)
4040
}
4141

4242
func TestInnerMainSuccessWithCommand(t *testing.T) {
43-
err := innerMain([]string{"go-wait-for-it", "-q", "true"})
43+
err := innerMain([]string{"wait-for-it", "-q", "true"})
4444
assert.Nil(t, err)
4545
}
4646

4747
func TestInnerMainSuccessWithoutCommand(t *testing.T) {
48-
err := innerMain([]string{"go-wait-for-it"})
48+
err := innerMain([]string{"wait-for-it"})
4949
assert.Nil(t, err)
5050
}
5151

5252
func TestMain(t *testing.T) {
5353
originalOsArgs := os.Args
5454
originalExitFunc := exitFunc
5555

56-
os.Args = []string{"go-wait-for-it", "-q", "--", "sh", "-c", "exit 123"}
56+
os.Args = []string{"wait-for-it", "-q", "--", "sh", "-c", "exit 123"}
5757
exitFunc = func(code int) {
5858
assert.Equal(t, 123, code)
5959
}

internal/cli/parser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func report(err error) {
2727

2828
func Parse(args []string) (config *Config, err error) {
2929
usageFooter := dedent.Dedent(`
30-
go-wait-for-it is software libre, licensed under the AGPL v3 or later license.
30+
wait-for-it is software libre, licensed under the AGPL v3 or later license.
3131
Please report bugs at https://github.com/hartwork/go-wait-for-it/issues. Thank you!
3232
`)
3333

@@ -63,7 +63,7 @@ func Parse(args []string) (config *Config, err error) {
6363
timeout,
6464
}
6565
},
66-
Version: "1.0.0",
66+
Version: "2.0.0",
6767
}
6868

6969
rootCommand.SetVersionTemplate("{{.Name}} {{.Version}}\n")

internal/cli/parser_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func TestParserHelpOutput(t *testing.T) {
8282
-t, --timeout uint timeout in seconds, 0 for no timeout (default 15)
8383
-v, --version version for wait-for-it
8484
85-
go-wait-for-it is software libre, licensed under the AGPL v3 or later license.
85+
wait-for-it is software libre, licensed under the AGPL v3 or later license.
8686
Please report bugs at https://github.com/hartwork/go-wait-for-it/issues. Thank you!
8787
`)[1:] // drop leading newline
8888

@@ -98,7 +98,7 @@ func TestParserVersionOutput(t *testing.T) {
9898
config, err := Parse([]string{"--version"})
9999
assert.Nil(t, err)
100100
assert.Nil(t, config)
101-
}, &os.Stdout, "wait-for-it 1.0.0\n")
101+
}, &os.Stdout, "wait-for-it 2.0.0\n")
102102
}
103103

104104
func TestParserUnknownFlag(t *testing.T) {

internal/testlab/output.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
)
1515

1616
func newTempFile(t *testing.T) *os.File {
17-
fd, err := ioutil.TempFile("", "go-wait-for-it-testing-")
17+
fd, err := ioutil.TempFile("", "wait-for-it-testing-")
1818
require.Nil(t, err)
1919
return fd
2020
}

0 commit comments

Comments
 (0)