Skip to content

Commit

Permalink
Merge pull request #108 from nyanshak/issue-67/simplify-options
Browse files Browse the repository at this point in the history
Issue #67: Simplify command line options
  • Loading branch information
langston-barrett committed Oct 26, 2015
2 parents e2c584c + d86386e commit 396697e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ releases. You can view the RPM source and build RPM snapshots at
Usage
-----

The default behavior is to run all checks in /etc/distributive.d/ (the default
directory give to the `-d` option), in addition to any specified via the `-f`
`-u`, or `-s` options.
The default behavior is to run any checks specified via `-f`, `-u`, `-s`,
or `-d` options, or all checks in /etc/distributive.d/ if no location is
specified.

```
$ distributive --help
Expand All @@ -93,10 +93,10 @@ Examples:

```
$ /path/to/distributive --verbosity="warn" -f ./samples/filesystem.json
$ distributive -d="" --f="/etc/distributive/samples/network.json" --verbosity=debug
$ ./distributive -d="" -u "http://pastebin.com/raw.php?i=5c1BAxcX"
$ distributive --f="/etc/distributive/samples/network.json" --verbosity=debug
$ ./distributive -u "http://pastebin.com/raw.php?i=5c1BAxcX"
$ /distributive --verbosity="info"
$ /path/to/distributive -d "/etc/distributive.d/"
$ /path/to/distributive -d "/etc/distributive.d/" # same as default behavior
$ cat samples/filesystem.json | ./distributive -d "" -s=true --verbosity=fatal
```

Expand Down Expand Up @@ -132,7 +132,7 @@ packages. These dependencies are outlined for each check on our
Comparison to Other Software
============================

Distributive was created with the idea of pushing responsibiliy to the nodes,
Distributive was created with the idea of pushing responsibility to the nodes,
It was also designed around the idea of constantly changing infrastructure, with
servers being added and destroyed constantly, changing IP addresses, and even
changing roles. Integration with Consul provides even
Expand Down
7 changes: 6 additions & 1 deletion options.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func getFlags() (f string, u string, d string, s bool) {
},
cli.StringFlag{
Name: "directory, d",
Value: "/etc/distributive.d/",
Value: "",
Usage: "Read all of the checklists in this directory",
},
cli.BoolFlag{
Expand All @@ -129,6 +129,11 @@ func getFlags() (f string, u string, d string, s bool) {
URL = c.String("url")
directory = c.String("directory")
stdin = c.Bool("stdin")

if file == "" && URL == "" && stdin == false && directory == "" {
// use default directory if no other options specified
directory = "/etc/distributive.d/"
}
log.WithFields(log.Fields{
"file": file,
"URL": URL,
Expand Down

0 comments on commit 396697e

Please sign in to comment.