~emersion/hut-dev

hut: Adding todo ticket url command v1 PROPOSED

Hey !
I added a simple command to be able to retrieve url of a ticket.
It's meant to be used to refer to a ticket inside a commit without
having to open a browser.

Thanks for taking it into consideration

Theo.

Kaporos (1):
  adding todo ticket url command

 todo.go | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

-- 
2.43.0
#1192946 .build.yml success
hut/patches/.build.yml: SUCCESS in 31s

[Adding todo ticket url command][0] from [~kaporos][1]

[0]: https://lists.sr.ht/~emersion/hut-dev/patches/50903
[1]: mailto:theo@daron.be

✓ #1192946 SUCCESS hut/patches/.build.yml https://builds.sr.ht/~emersion/job/1192946
I didn't see another place to put this command but I'm open to any suggestions

I didn't knew about hyperlink escapes but yes it could be great :)
25 avr. 2024 20:10:39 Simon Ser <contact@emersion.fr>:
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/hut-dev/patches/50903/mbox | git am -3
Learn more about email & git

[PATCH hut 1/1] adding todo ticket url command Export this patch

From: Kaporos <theo@daron.be>

---
 todo.go | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/todo.go b/todo.go
index cf62874..21e7bc7 100644
--- a/todo.go
+++ b/todo.go
@@ -272,6 +272,7 @@ func newTodoTicketCommand() *cobra.Command {
	cmd.AddCommand(newTodoTicketUnassignCommand())
	cmd.AddCommand(newTodoTicketDeleteCommand())
	cmd.AddCommand(newTodoTicketShowCommand())
	cmd.AddCommand(newTodoTicketUrlCommand())
	cmd.AddCommand(newTodoTicketWebhookCommand())
	cmd.AddCommand(newTodoTicketCreateCommand())
	cmd.AddCommand(newTodoTicketEditCommand())
@@ -710,6 +711,29 @@ func newTodoTicketDeleteCommand() *cobra.Command {
	cmd.Flags().BoolVarP(&autoConfirm, "yes", "y", false, "auto confirm")
	return cmd
}
func newTodoTicketUrlCommand() *cobra.Command {
	run := func(cmd *cobra.Command, args []string) {
		ctx := cmd.Context()

		ticketId, name, owner, instance, err := parseTicketResource(ctx, cmd, args[0])
		if err != nil {
			log.Fatal(err)
		}

		c := createClientWithInstance("todo", cmd, instance)
		// trackerID := getTrackerID(c, ctx, name, owner)
		fmt.Printf("%s/%s/%s/%d", c.BaseURL, owner, name, ticketId)
	}

	cmd := &cobra.Command{
		Use:               "url <ID>",
		Short:             "Get url of a ticket",
		Args:              cobra.ExactArgs(1),
		ValidArgsFunction: completeTicketID,
		Run:               run,
	}
	return cmd
}

func newTodoTicketShowCommand() *cobra.Command {
	run := func(cmd *cobra.Command, args []string) {
-- 
2.43.0
hut/patches/.build.yml: SUCCESS in 31s

[Adding todo ticket url command][0] from [~kaporos][1]

[0]: https://lists.sr.ht/~emersion/hut-dev/patches/50903
[1]: mailto:theo@daron.be

✓ #1192946 SUCCESS hut/patches/.build.yml https://builds.sr.ht/~emersion/job/1192946