Browse Source

Release 1.0.0

tags/v1.0.0
Lex Toumbourou 4 years ago
parent
commit
de3639f3bc
2 changed files with 68 additions and 7 deletions
  1. +7
    -0
      .travis.yml
  2. +61
    -7
      README.md

+ 7
- 0
.travis.yml View File

@@ -0,0 +1,7 @@
language: go

go:
- tip

script:
- go test

+ 61
- 7
README.md View File

@@ -19,31 +19,69 @@ $ goodhosts list
### Check for an entry.

```bash
$ goodhosts check 10.0.0.5 my-home-server
$ goodhosts check 127.0.0.1 facebook
```

### Add an entry.

```bash
$ goodhosts add 10.0.0.5 music-server
$ goodhosts add 127.0.0.1 facebook
```

### Remove an entry.

```bash
$ goodhosts remove 10.0.0.5 music-server
$ goodhosts remove 127.0.0.1 facebook
```

## API Usage

### [Docs](API.md)
### List entries.

```go
package main

### Examples
import (
"fmt"
"github.com/lextoumbourou/goodhosts"
)

Send Facebook to localhost in hosts file.
func main() {
h := hosts.NewHosts()
for _, line := range hosts.Lines {
fmt.Printf(line.Raw)
}
}
```

### Check for an entry.

```go
package main

import (
"fmt"
"github.com/lextoumbourou/goodhosts"
)

func main() {
h := hosts.NewHosts()
if h.HasEntry("127.0.0.1", "facebook") {
fmt.Println("Entry exists!")
}
}
```

### Add an entry.

```go
package main

import (
"fmt"
"github.com/lextoumbourou/goodhosts"
)

func main() {
h := hosts.NewHosts()

@@ -56,9 +94,16 @@ func main() {
}
```

Remove Facebook from the hosts file
### Remove an entry.

```go
package main

import (
"fmt"
"github.com/lextoumbourou/goodhosts"
)

func main() {
h := hosts.NewHosts()

@@ -70,6 +115,15 @@ func main() {
}
}
```

### [API Docs](API.md)

## Changelog

### 1.0.0 (2015-05-03)

- Initial release.

## License

[MIT](LICENSE)

Loading…
Cancel
Save