Skip to content

Commit

Permalink
misc: Format files and help messages; Remove fpm build
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinGimbel committed Nov 10, 2017
1 parent e8b5601 commit 932f20a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 21 deletions.
10 changes: 0 additions & 10 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,3 @@ brew:
name: homebrew-tap
homepage: https://github.com/kevingimbel/license
description: "CLI tool to download license files."

fpm:
vendor: Kevin Gimbel
homepage: https://github.com/kevingimbel/license
maintainer: Kevin Gimbel <kevin@kevin.codes>
description: "CLI tool to download license files."
license: MIT
formats:
- deb
- rpm
15 changes: 8 additions & 7 deletions cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@ package cmd

import (
"fmt"
"github.com/kevingimbel/license/lib"
"github.com/spf13/cobra"
"io"
"net/http"
"os"
"io"
"strings"

"github.com/kevingimbel/license/lib"
"github.com/spf13/cobra"
)

var format string

func init() {
RootCmd.AddCommand(getCmd)
getCmd.Flags().StringVarP(&format, "format", "f","", "LICENSE file format")
getCmd.Flags().StringVarP(&format, "format", "f", "", "LICENSE file format")
}

// getCmd represents the get command
Expand All @@ -23,8 +24,8 @@ var getCmd = &cobra.Command{
Short: "Download a license file by ID",
Long: fmt.Sprintf(`Download a license file by ID from %s
The license file is saved in the current directory and will be named LICENSE. To specify a file extension use the --format flag.
To see a list of all licenses, run "license list". Use the ID to download a license.
The license file is saved in the current directory and will be named LICENSE. To specify a file extension use the --format flag.
To see a list of all licenses, run "license list". Use the ID to download a license.
`, lib.GetBaseURL()),
Run: func(cmd *cobra.Command, args []string) {
// Assume args[0] is the license name
Expand Down Expand Up @@ -77,4 +78,4 @@ func downloadLicense(url string) error {
}

return nil
}
}
6 changes: 3 additions & 3 deletions cmd/update.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package cmd

import (
"encoding/json"
"fmt"
"net/http"
"os"
"encoding/json"

"github.com/kevingimbel/license/lib"
"github.com/spf13/cobra"
)


// getCmd represents the get command
var updateCmd = &cobra.Command{
Use: "update",
Short: "Fetch the latest license data",
Long: fmt.Sprintf(`Download the latest license data as JSON from http://osl.kevin.codes/licenses/
The downlaoded data is stored inside the %s file.
The downlaoded data is stored inside the %s file.
`, lib.GetOutputFilePath()),
Run: func(cmd *cobra.Command, args []string) {
Update()
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ func main() {
fmt.Println(err)
os.Exit(1)
}
}
}

0 comments on commit 932f20a

Please sign in to comment.