Skip to content

Commit

Permalink
Change command-line tool name to 'revel'
Browse files Browse the repository at this point in the history
And remove all the tildes.
  • Loading branch information
robfig committed Sep 23, 2012
1 parent 8630232 commit ac99376
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 54 deletions.
22 changes: 11 additions & 11 deletions cmd/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import (
var cmdClean = &Command{
UsageLine: "clean [import path]",
Short: "clean a Revel application's temp files",
Long: `~
~ Clean the Revel web application named by the given import path.
~
~ For example:
~
~ rev clean github.com/robfig/revel/samples/chat
~
~ It removes the app/tmp directory.
Long: `
Clean the Revel web application named by the given import path.
For example:
revel clean github.com/robfig/revel/samples/chat
It removes the app/tmp directory.
`,
}

Expand All @@ -33,16 +33,16 @@ func cleanApp(args []string) {

appPkg, err := build.Import(args[0], "", build.FindOnly)
if err != nil {
fmt.Fprintln(os.Stderr, "~ Abort: Failed to find import path:", err)
fmt.Fprintln(os.Stderr, "Abort: Failed to find import path:", err)
return
}

// Remove the app/tmp directory.
tmpDir := path.Join(appPkg.Dir, "app", "tmp")
fmt.Println("~ Removing:", tmpDir)
fmt.Println("Removing:", tmpDir)
err = os.RemoveAll(tmpDir)
if err != nil {
fmt.Fprintln(os.Stderr, "~ Abort:", err)
fmt.Fprintln(os.Stderr, "Abort:", err)
return
}
}
26 changes: 14 additions & 12 deletions cmd/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ import (
var cmdNew = &Command{
UsageLine: "new [path]",
Short: "create a skeleton Revel application",
Long: `~
~ New creates a few files to get a new Revel application running quickly.
~
~ It puts all of the files in the given directory, taking the final element in
~ the path to be the app name.
~
~ For example:
~ rev new github.com/robfig/chatapp`,
Long: `
New creates a few files to get a new Revel application running quickly.
It puts all of the files in the given directory, taking the final element in
the path to be the app name.
For example:
revel new path/to/chatapp
`,
}

func init() {
Expand All @@ -33,18 +35,18 @@ var (

func newApp(args []string) {
if len(args) == 0 {
errorf("~ No path given.\nRun 'rev help new' for usage.\n")
errorf("No path given.\nRun 'revel help new' for usage.\n")
}

_, err := os.Open(args[0])
if err == nil {
fmt.Fprintf(os.Stderr, "~ Abort: Directory %s already exists.\n", args[0])
fmt.Fprintf(os.Stderr, "Abort: Directory %s already exists.\n", args[0])
return
}

revelPkg, err := build.Import("github.com/robfig/revel", "", build.FindOnly)
if err != nil {
fmt.Fprintln(os.Stderr, "~ Failed to find revel code.")
fmt.Fprintln(os.Stderr, "Failed to find revel code.")
return
}

Expand All @@ -59,7 +61,7 @@ func newApp(args []string) {
"Secret": genSecret(),
})

fmt.Fprintln(os.Stdout, "~ Your application is ready:\n~ ", appDir)
fmt.Fprintln(os.Stdout, "Your application is ready:\n ", appDir)
}

const alphaNumeric = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
Expand Down
18 changes: 9 additions & 9 deletions cmd/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import (
var cmdPackage = &Command{
UsageLine: "package [import path]",
Short: "package a Revel application (e.g. for deployment)",
Long: `~
~ Package the Revel web application named by the given import path.
~ This allows it to be deployed and run on a machine that lacks a Go installation.
~
~ For example:
~
~ rev package github.com/robfig/revel/samples/chat
~`,
Long: `
Package the Revel web application named by the given import path.
This allows it to be deployed and run on a machine that lacks a Go installation.
For example:
revel package github.com/robfig/revel/samples/chat
`,
}

func init() {
Expand Down Expand Up @@ -74,5 +74,5 @@ func packageApp(args []string) {
// Create the zip file.
zipName := mustZipDir(rev.AppName+".zip", tmpDir)

fmt.Println("~ Your archive is ready:", zipName)
fmt.Println("Your archive is ready:", zipName)
}
18 changes: 9 additions & 9 deletions cmd/rev.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func main() {
}
}

errorf("~ unknown command %q\nRun 'rev help' for usage.\n", args[0])
errorf("unknown command %q\nRun 'revel help' for usage.\n", args[0])
}

func errorf(format string, args ...interface{}) {
Expand All @@ -81,16 +81,16 @@ const header = `~
~
`

const usageTemplate = `~ usage: rev command [arguments]
~
~ The commands are:
~{{range .}}
~ {{.Name | printf "%-11s"}} {{.Short}}{{end}}
~
~ Use "rev help [command]" for more information.
const usageTemplate = `usage: revel command [arguments]
The commands are:
{{range .}}
{{.Name | printf "%-11s"}} {{.Short}}{{end}}
Use "revel help [command]" for more information.
`

var helpTemplate = `~ usage: rev {{.UsageLine}}
var helpTemplate = `usage: revel {{.UsageLine}}
{{.Long}}
`

Expand Down
24 changes: 12 additions & 12 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import (
var cmdRun = &Command{
UsageLine: "run [import path] [run mode]",
Short: "run a Revel application",
Long: `~
~ Run the Revel web application named by the given import path.
~
~ For example, to run the chat room sample application:
~
~ rev run github.com/robfig/revel/samples/chat
~
~ The run mode is used to select which set of app.conf configuration should
~ apply and may be used to determine logic in the application itself.
~
~ Run mode defaults to "dev".`,
Long: `
Run the Revel web application named by the given import path.
For example, to run the chat room sample application:
revel run github.com/robfig/revel/samples/chat dev
The run mode is used to select which set of app.conf configuration should
apply and may be used to determine logic in the application itself.
Run mode defaults to "dev".`,
}

func init() {
Expand All @@ -28,7 +28,7 @@ func init() {

func runApp(args []string) {
if len(args) == 0 {
errorf("~ No import path given.\nRun 'rev help run' for usage.\n")
errorf("No import path given.\nRun 'revel help run' for usage.\n")
}

mode := "dev"
Expand Down
2 changes: 1 addition & 1 deletion cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type LoggedError struct{ error }

func panicOnError(err error, msg string) {
if revErr, ok := err.(*rev.Error); (ok && revErr != nil) || (!ok && err != nil) {
fmt.Fprintf(os.Stderr, "~ Abort: %s: %s\n", msg, err)
fmt.Fprintf(os.Stderr, "Abort: %s: %s\n", msg, err)
panic(LoggedError{err})
}
}
Expand Down

0 comments on commit ac99376

Please sign in to comment.