Skip to content

Commit

Permalink
Edits help text and rearranges placement
Browse files Browse the repository at this point in the history
    - Moves DESCRIPTION above SYNOPSIS in man page
    - Moves config above init for commands
    - Edits USAGE text to emphasize usage
    - Edits DESCRIPTION text to describe tool rather than making of it

Issue #204
  • Loading branch information
annegentle committed Aug 19, 2015
1 parent 54488e2 commit 080309d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
37 changes: 16 additions & 21 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ package main
import (
"fmt"
"os"
"strings"

"github.com/rackspace/rack/commands/blockstoragecommands"
"github.com/rackspace/rack/commands/filescommands"
"github.com/rackspace/rack/commands/networkscommands"
"github.com/rackspace/rack/commands/serverscommands"
"github.com/rackspace/rack/setup"
"github.com/rackspace/rack/util"
"github.com/jrperritt/rack/commands/blockstoragecommands"
"github.com/jrperritt/rack/commands/filescommands"
"github.com/jrperritt/rack/commands/networkscommands"
"github.com/jrperritt/rack/commands/serverscommands"
"github.com/jrperritt/rack/setup"
"github.com/jrperritt/rack/util"

"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
)

func main() {
Expand All @@ -37,34 +36,30 @@ func main() {

// Usage returns, you guessed it, the usage information
func Usage() string {
return "An opinionated CLI for the Rackspace cloud"
return "Command-line interface to manage Rackspace Cloud resources"
}

// Desc returns, you guessed it, the description
func Desc() string {
return `Rack is an opinionated command-line tool that allows Rackspace users
to accomplish tasks in a simple, idiomatic way. It seeks to provide
flexibility through common Unix practices like piping and composability. All
commands have been tested against Rackspace's live API.`
return `The rack CLI manages authentication, configures a local setup, and provides workflows for operations on Rackspace cloud resources.`
}

// Cmds returns a list of commands supported by the tool
func Cmds() []cli.Command {
return []cli.Command{
{
Name: "init",
Usage: strings.Join([]string{"For Linux and OS X, creates the `rack` man page and sets up command completion for the Bash shell.",
"\tFor Windows, creates a `posh_autocomplete.ps1` file in the `$HOME/.rack` directory. You must run the file to set up command completion."}, "\n"),
Name: "configure",
Usage: "Interactively create a config file for Rackspace authentication.",
Action: configure,
},
{
Name: "init",
Usage: "[Linux/OS X only] Creates the rack man page and sets up command completion for the Bash shell.",
Action: func(c *cli.Context) {
setup.Init(c)
man()
},
},
{
Name: "configure",
Usage: "Interactively create a config file for Rackspace authentication.",
Action: configure,
},
{
Name: "version",
Usage: "Print the version of this binary.",
Expand Down
12 changes: 6 additions & 6 deletions man.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"strings"
"time"

"github.com/rackspace/rack/commandoptions"
"github.com/rackspace/rack/internal/github.com/codegangsta/cli"
"github.com/rackspace/rack/util"
"github.com/jrperritt/rack/commandoptions"
"github.com/jrperritt/rack/internal/github.com/codegangsta/cli"
"github.com/jrperritt/rack/util"
)

func man() {
Expand All @@ -17,10 +17,10 @@ func man() {
content += fmt.Sprintf(`.TH man 1 "%s" "%s" "rack man page"`+"\n", time.Now().Format("06 May 2010"), util.Version)
content += fmt.Sprintln(`.SH NAME`)
content += fmt.Sprintf(`rack \- %s`+"\n", Usage())
content += fmt.Sprintln(`.SH SYNOPSIS`)
content += fmt.Sprintln("rack <command> <subcommand> <action> [OPTIONS]")
content += fmt.Sprintln(`.SH DESCRIPTION`)
content += fmt.Sprintf("%s\n\n\n", Desc())
content += fmt.Sprintln(`.SH SYNOPSIS`)
content += fmt.Sprintln("rack <command> <subcommand> <action> [OPTIONS]")

content += fmt.Sprintln("The following global options are available:")
for _, flag := range commandoptions.GlobalFlags() {
Expand Down Expand Up @@ -63,7 +63,7 @@ func man() {
}

content += fmt.Sprintln(".SH BUGS")
content += fmt.Sprintln("See https://github.com/rackspace/rack/issues")
content += fmt.Sprintln("See https://github.com/jrperritt/rack/issues")

ioutil.WriteFile("rack.1", []byte(content), 0755)
}
Expand Down

0 comments on commit 080309d

Please sign in to comment.