Skip to content

Commit

Permalink
refactor: move filename to flag
Browse files Browse the repository at this point in the history
  • Loading branch information
josegonzalez committed Dec 23, 2018
1 parent bd3896f commit 8010b8e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ make build
## usage

```
Usage: sshd-config <command> <filename> <key> [<value>]
Usage: sshd-config <command> <key> [<value>] [--filename=<filename>]
sshd-config -h | --help
sshd-config --version
Options:
-h --help Show this screen.
--version Show version.
-h --help Show this screen.
--version Show version.
--filename=<filename> The sshd-config to modify [default: /etc/ssh/sshd_config]
Commands:
add Add a value to a key
Expand Down
9 changes: 5 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,14 @@ func commandUnset(arguments docopt.Opts, entries map[string]entry, filename stri
func main() {
usage := `sshd-config.
Usage: sshd-config <command> <filename> <key> [<value>]
Usage: sshd-config <command> <key> [<value>] [--filename=<filename>]
sshd-config -h | --help
sshd-config --version
Options:
-h --help Show this screen.
--version Show version.
-h --help Show this screen.
--version Show version.
--filename=<filename> The sshd-config to modify [default: /etc/ssh/sshd_config]
Commands:
add Add a value to a key
Expand All @@ -151,7 +152,7 @@ Commands:

arguments, _ := docopt.ParseArgs(usage, os.Args[1:], "0.1.0")

filename, err := arguments.String("<filename>")
filename, err := arguments.String("--filename")
if err != nil {
log.Printf("error: %s", err)
}
Expand Down

0 comments on commit 8010b8e

Please sign in to comment.