improve the documentation

This commit is contained in:
Kevin Burke
2017-05-25 08:16:57 -07:00
parent b365efcd38
commit 8b24c0d360
+10 -2
View File
@@ -4,8 +4,12 @@ This is a Go parser for `ssh_config` files. Importantly, this parser attempts
to preserve comments in a given file, so you can manipulate a `ssh_config` file
from a program, if your heart desires.
It's designed to be used with the excellent
[x/crypto/ssh](https://golang.org/x/crypto/ssh) package, which handles SSH
negotiation but isn't very easy to configure.
The `ssh_config` `Get()` and `GetStrict()` functions will attempt to read values
from `$HOME/.ssh/config`, falling back to `/etc/ssh/ssh_config`. The first
from `$HOME/.ssh/config` and fall back to `/etc/ssh/ssh_config`. The first
argument is the host name to match on, and the second argument is the key you
want to retrieve.
@@ -13,6 +17,10 @@ want to retrieve.
port := ssh_config.Get("myhost", "Port")
```
Some SSH arguments have default values - for example, the default value for
`KeyboardAuthentication` is `"yes"`. If we can't find a value for the given
Host/keyword pair, and a default exists for the keyword, we return it.
Here's how you can manipulate an SSH config file, and then write it back.
```go
@@ -33,7 +41,7 @@ fmt.Println(cfg.String())
Wherever possible we try to implement the specification as documented in
the `ssh_config` manpage. Unimplemented features should be present in the
[issues][issues] list.
[issues][issues] list. Notably, the `Match` directive is currently unsupported.
[issues]: https://github.com/kevinburke/ssh_config/issues