change long descriptions
This commit is contained in:
parent
3bbb21dfc5
commit
b5db233263
12
cmd/ed.go
12
cmd/ed.go
@ -25,14 +25,14 @@ import (
|
|||||||
|
|
||||||
// edCmd represents the ed command
|
// edCmd represents the ed command
|
||||||
var edCmd = &cobra.Command{
|
var edCmd = &cobra.Command{
|
||||||
Use: "ed",
|
Use: "ed [id]",
|
||||||
Short: "Edit a todo",
|
Short: "Edit a todo",
|
||||||
Long: `A longer description that spans multiple lines and likely contains examples
|
Long: `Edit a todo giving an ID as arg1, then all args are
|
||||||
and usage of using your command. For example:
|
taken as a string.
|
||||||
|
|
||||||
Cobra is a CLI library for Go that empowers applications.
|
You can edit a due date with '-d DATE'.
|
||||||
This application is a tool to generate the needed files
|
You can mark a todo as completed with '-c'.
|
||||||
to quickly create a Cobra application.`,
|
`,
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
if cmd.Flags().NFlag() >= 1 {
|
if cmd.Flags().NFlag() >= 1 {
|
||||||
if err := cobra.MinimumNArgs(1)(cmd, args); err != nil {
|
if err := cobra.MinimumNArgs(1)(cmd, args); err != nil {
|
||||||
|
10
cmd/ls.go
10
cmd/ls.go
@ -30,12 +30,12 @@ import (
|
|||||||
var lsCmd = &cobra.Command{
|
var lsCmd = &cobra.Command{
|
||||||
Use: "ls",
|
Use: "ls",
|
||||||
Short: "List todos",
|
Short: "List todos",
|
||||||
Long: `A longer description that spans multiple lines and likely contains examples
|
Long: `List todos. By default, lists uncompleted todos.
|
||||||
and usage of using your command. For example:
|
|
||||||
|
|
||||||
Cobra is a CLI library for Go that empowers applications.
|
If given '-c' flag, lists completed todos.
|
||||||
This application is a tool to generate the needed files
|
Otherwise, you can list all todos with '-a'.
|
||||||
to quickly create a Cobra application.`,
|
|
||||||
|
You can list showing all fields with '-v'.`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
var todos []Todo
|
var todos []Todo
|
||||||
all, err := cmd.Flags().GetBool("all")
|
all, err := cmd.Flags().GetBool("all")
|
||||||
|
@ -40,12 +40,9 @@ func sliceAtoi(s []string) []int {
|
|||||||
var newCmd = &cobra.Command{
|
var newCmd = &cobra.Command{
|
||||||
Use: "new",
|
Use: "new",
|
||||||
Short: "Create new todo",
|
Short: "Create new todo",
|
||||||
Long: `A longer description that spans multiple lines and likely contains examples
|
Long: `Create new todo with optional due date using '-d DATE'.
|
||||||
and usage of using your command. For example:
|
|
||||||
|
|
||||||
Cobra is a CLI library for Go that empowers applications.
|
You can also mark todo as completed when creating it with '-c'.`,
|
||||||
This application is a tool to generate the needed files
|
|
||||||
to quickly create a Cobra application.`,
|
|
||||||
Args: cobra.MinimumNArgs(1),
|
Args: cobra.MinimumNArgs(1),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
dateString, err := cmd.Flags().GetString("due")
|
dateString, err := cmd.Flags().GetString("due")
|
||||||
|
10
cmd/rm.go
10
cmd/rm.go
@ -24,14 +24,9 @@ import (
|
|||||||
|
|
||||||
// rmCmd represents the rm command
|
// rmCmd represents the rm command
|
||||||
var rmCmd = &cobra.Command{
|
var rmCmd = &cobra.Command{
|
||||||
Use: "rm",
|
Use: "rm [id]",
|
||||||
Short: "Remove a todo",
|
Short: "Remove a todo",
|
||||||
Long: `A longer description that spans multiple lines and likely contains examples
|
Long: `Remove a todo given its id.`,
|
||||||
and usage of using your command. For example:
|
|
||||||
|
|
||||||
Cobra is a CLI library for Go that empowers applications.
|
|
||||||
This application is a tool to generate the needed files
|
|
||||||
to quickly create a Cobra application.`,
|
|
||||||
Args: cobra.MinimumNArgs(1),
|
Args: cobra.MinimumNArgs(1),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
id, err := strconv.ParseUint(args[0], 10, 0)
|
id, err := strconv.ParseUint(args[0], 10, 0)
|
||||||
@ -42,5 +37,4 @@ to quickly create a Cobra application.`,
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(rmCmd)
|
rootCmd.AddCommand(rmCmd)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
11
cmd/root.go
11
cmd/root.go
@ -26,14 +26,11 @@ import (
|
|||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "todo",
|
Use: "todo",
|
||||||
Short: "Minimal todo app",
|
Short: "Minimal todo app",
|
||||||
Long: `A longer description that spans multiple lines and likely contains
|
Long: `Minimal todo app which lets you create,
|
||||||
examples and usage of using your application. For example:
|
remove, edit and list your todos.
|
||||||
|
|
||||||
Cobra is a CLI library for Go that empowers applications.
|
You can optionally add due date and mark todo as completed.
|
||||||
This application is a tool to generate the needed files
|
Running without flags lists all uncompleted todos.`,
|
||||||
to quickly create a Cobra application.`,
|
|
||||||
// Uncomment the following line if your bare application
|
|
||||||
// has an action associated with it:
|
|
||||||
Run: lsCmd.Run,
|
Run: lsCmd.Run,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user