Skip to content

Commit

Permalink
Capitalized, clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLitt committed Feb 18, 2016
1 parent aeac6d9 commit a3ff664
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import (

func main() {
app := cli.NewApp()
app.Usage = "update ipfs"
app.Usage = "Update ipfs."
app.Version = "0.1.0"

app.Flags = []cli.Flag{
cli.BoolFlag{
Name: "verbose",
Usage: "print verbose output",
Usage: "Print verbose output.",
},
}

Expand All @@ -43,7 +43,7 @@ func main() {

var cmdVersions = cli.Command{
Name: "versions",
Usage: "print out all available versions",
Usage: "Print out all available versions.",
ArgsUsage: " ",
Action: func(c *cli.Context) {
vs, err := GetVersions(util.IpfsVersionPath)
Expand All @@ -59,7 +59,7 @@ var cmdVersions = cli.Command{

var cmdVersion = cli.Command{
Name: "version",
Usage: "print out currently installed version",
Usage: "Print out currently installed version.",
Action: func(c *cli.Context) {
v, err := GetCurrentVersion()
if err != nil {
Expand All @@ -72,27 +72,27 @@ var cmdVersion = cli.Command{

var cmdInstall = cli.Command{
Name: "install",
Usage: "install a version of ipfs",
Usage: "Install a version of ipfs.",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "no-check",
Usage: "skip running of pre-install tests",
Usage: "Skip pre-install tests.",
},
},
Action: func(c *cli.Context) {
vers := c.Args().First()
if vers == "" {
stump.Fatal("Please specify a version to install")
stump.Fatal("Please specify a version to install.")
}
if vers == "latest" {
latest, err := GetLatestVersion(util.IpfsVersionPath)
if err != nil {
stump.Fatal("error resolving 'latest': ", err)
stump.Fatal("Error resolving 'latest': ", err)
}
vers = latest
}
if !strings.HasPrefix(vers, "v") {
stump.VLog("version strings must start with 'v', autocorrecting...")
stump.VLog("Version strings must start with 'v'. Autocorrecting...")
vers = "v" + vers
}

Expand All @@ -105,24 +105,24 @@ var cmdInstall = cli.Command{
if err != nil {
stump.Fatal(err)
}
stump.Log("\ninstallation complete.")
stump.Log("\nInstallation complete!")

if util.HasDaemonRunning() {
stump.Log("remember to restart your daemon before continuing")
stump.Log("Remember to restart your daemon before continuing.")
}
},
}

var cmdStash = cli.Command{
Name: "stash",
Usage: "stashes copy of currently installed ipfs binary",
Description: `stash is an advanced command that saves the currently installed
Description: `'stash' is an advanced command that saves the currently installed
version of ipfs to a backup location. This is useful when you want to experiment
with different versions but still be able to go back to the version you started from.`,
with different versions, but still be able to go back to the version you started with.`,
Flags: []cli.Flag{
cli.StringFlag{
Name: "tag",
Usage: "optionally specify tag for stashed binary",
Usage: "Optionally specify tag for stashed binary.",
},
},
Action: func(c *cli.Context) {
Expand All @@ -144,11 +144,11 @@ var cmdStash = cli.Command{

var cmdRevert = cli.Command{
Name: "revert",
Usage: "revert to previously installed version of ipfs",
Usage: "Revert to previously installed version of ipfs.",
ArgsUsage: " ",
Description: `revert will check if a previous update left a stashed
Description: `'revert' will check if a previous update left a stashed
binary and overwrite the current ipfs binary with it.
if multiple previous versions exist, you will be prompted to select the
If multiple previous versions exist, you will be prompted to select the
desired binary.`,
Action: func(c *cli.Context) {
oldbinpath, err := selectRevertBin()
Expand All @@ -165,8 +165,8 @@ var cmdRevert = cli.Command{
binpath := string(oldpath)
err = InstallBinaryTo(oldbinpath, binpath)
if err != nil {
stump.Error("failed to move old binary: %s", oldbinpath)
stump.Error("to path: %s", binpath)
stump.Error("Failed to move old binary: %s", oldbinpath)
stump.Error("To path: %s", binpath)
stump.Fatal(err)
}
stump.Log("\nrevert complete.")
Expand All @@ -175,12 +175,12 @@ var cmdRevert = cli.Command{

var cmdFetch = cli.Command{
Name: "fetch",
Usage: "fetch a given (default: latest) version of ipfs",
Usage: "Fetch a given version of ipfs. Default: latest.",
ArgsUsage: "<version>",
Flags: []cli.Flag{
cli.StringFlag{
Name: "output",
Usage: "specify where to save the downloaded binary",
Usage: "Specify where to save the downloaded binary.",
},
},
Action: func(c *cli.Context) {
Expand All @@ -189,14 +189,14 @@ var cmdFetch = cli.Command{
stump.VLog("looking up 'latest'")
latest, err := GetLatestVersion(util.IpfsVersionPath)
if err != nil {
stump.Fatal("error querying latest version: ", err)
stump.Fatal("Error querying latest version: ", err)
}

vers = latest
}

if !strings.HasPrefix(vers, "v") {
stump.VLog("version strings must start with 'v', autocorrecting...")
stump.VLog("Version strings must start with 'v'. Autocorrecting...")
vers = "v" + vers
}

Expand All @@ -208,7 +208,7 @@ var cmdFetch = cli.Command{

_, err := os.Stat(output)
if err == nil {
stump.Fatal("file named %q already exists", output)
stump.Fatal("File named %q already exists.", output)
}

if !os.IsNotExist(err) {
Expand All @@ -222,7 +222,7 @@ var cmdFetch = cli.Command{

err = os.Chmod(output, 0755)
if err != nil {
stump.Fatal("setting new binary executable: ", err)
stump.Fatal("Setting new binary executable: ", err)
}
},
}

0 comments on commit a3ff664

Please sign in to comment.