From c84fde2febf280c90486d0fa7cfa1a1389fa4ead Mon Sep 17 00:00:00 2001 From: Yuan Gong Date: Sat, 12 Mar 2022 11:42:01 +0000 Subject: [PATCH] chore: update CLI usages --- check.go | 8 +++++--- csv.go | 8 +++++--- main.go | 17 ++++++++++++++++- save.go | 8 +++++--- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/check.go b/check.go index 83b33fe6..06406283 100644 --- a/check.go +++ b/check.go @@ -24,9 +24,11 @@ import ( ) var ( - checkCmd = &cobra.Command{ - Use: "check ", - Short: "Checks whether licenses for a package are not Forbidden.", + checkHelp = "Checks whether licenses for a package are not Forbidden." + checkCmd = &cobra.Command{ + Use: "check [package...]", + Short: checkHelp, + Long: checkHelp + packageHelp, Args: cobra.MinimumNArgs(1), RunE: checkMain, } diff --git a/csv.go b/csv.go index 0581b503..6676d53b 100644 --- a/csv.go +++ b/csv.go @@ -25,9 +25,11 @@ import ( ) var ( - csvCmd = &cobra.Command{ - Use: "csv ", - Short: "Prints all licenses that apply to a Go package and its dependencies", + csvHelp = "Prints all licenses that apply to one or more Go packages and their dependencies." + csvCmd = &cobra.Command{ + Use: "csv [package...]", + Short: csvHelp, + Long: csvHelp + packageHelp, Args: cobra.MinimumNArgs(1), RunE: csvMain, } diff --git a/main.go b/main.go index d4c1c944..8837b9ab 100644 --- a/main.go +++ b/main.go @@ -26,11 +26,26 @@ import ( var ( rootCmd = &cobra.Command{ - Use: "licenses", + Use: "go-licenses", + Short: "go-licenses helps you work with licenses of your go project's dependencies.", + Long: `go-licenses helps you work with licenses of your go project's dependencies. + +Prerequisites: +1. Go v1.16 or later. +2. Change directory to your go project. +3. Run "go mod download".`, } // Flags shared between subcommands confidenceThreshold float64 + packageHelp = ` + +Typically, specify the Go package that builds your Go binary. +go-licenses expects the same package argument format as "go build". +For example: +* A rooted import path like "github.com/google/go-licenses" or "github.com/google/go-licenses/licenses". +* A relative path that denotes the package in that directory, like "." or "./cmd/some-command". +To learn more about Go package argument, run "go help packages".` ) func init() { diff --git a/save.go b/save.go index ddae7e20..ff7271b8 100644 --- a/save.go +++ b/save.go @@ -30,9 +30,11 @@ import ( ) var ( - saveCmd = &cobra.Command{ - Use: "save ", - Short: "Saves licenses, copyright notices and source code, as required by a Go package's dependencies, to a directory.", + saveHelp = "Saves licenses, copyright notices and source code, as required by a Go package's dependencies, to a directory." + saveCmd = &cobra.Command{ + Use: "save [package...]", + Short: saveHelp, + Long: saveHelp + packageHelp, Args: cobra.MinimumNArgs(1), RunE: saveMain, }