Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the help text when zero arguments given to the edit command #263

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AP-Hunt
Copy link

@AP-Hunt AP-Hunt commented Aug 18, 2022

Hi,

This is a small quality of life change I hope you'll accept. I'm happy to do the work to apply this change more broadly too, if you'd prefer.

Previously, Ultralist would panic when given zero arguments. I think it should should show the help text instead.

Before

$ ultralist e
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/ultralist/ultralist/cmd.init.7.func1(0xc00022b080, {0x176feb0, 0x0, 0x0})
	github.com/ultralist/ultralist/cmd/edit.go:44 +0x21c
github.com/spf13/cobra.(*Command).execute(0xc00022b080, {0x176feb0, 0x0, 0x0})
	github.com/spf13/cobra@v1.0.0/command.go:846 +0x5f8
github.com/spf13/cobra.(*Command).ExecuteC(0x1736dc0)
	github.com/spf13/cobra@v1.0.0/command.go:950 +0x3ad
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.0.0/command.go:887
github.com/ultralist/ultralist/cmd.Execute()
	github.com/ultralist/ultralist/cmd/root.go:23 +0x25
main.main()
	github.com/ultralist/ultralist/main.go:8 +0x17

After

$ ./bin/ultralist e
Edits todos.

  You can edit all facets of a todo.

  Read the full docs at https://ultralist.io/docs/cli/managing_tasks/#editing-todos

Usage:
  ultralist edit [id] [flags]

Aliases:
  edit, e

Examples:
  To edit a todo's subject:
    ultralist edit 33 Meeting with @bob about +project
    ultralist e 33 Change the subject once again

  To edit just the due date, keeping the subject:
    ultralist edit 33 due:mon

  To remove a due date:
    ultralist edit 33 due none

  To edit a status
    ultralist edit 33 status:next

	To remove a status:
    ultralist edit 33 status:none

Flags:
  -h, --help   help for edit

Previously, ultralist would panic when given zero arguments. It should should
show the help text instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant