You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You could merge do-it commands into the respective menu commands.
This, for example:
(transient-define-prefix magit-stgit-undo ()
"Undo a previous stack operation.":man-page"stg-undo"
["Arguments"
("-n""Undo the last N operations""--number=":reader (lambda (prompt_initial-inputhistory)
(number-to-string (read-number prompt nil history))))
("-h""Discard changes in index/worktree""--hard")]
["Actions"
("z""Undo" magit-stgit--undo)])
;;;###autoload
(defunmagit-stgit--undo (&restargs)
"Invoke `stg undo ARGS...'."
(interactive (transient-args 'magit-stgit-undo))
(magit-run-stgit "undo" args))
would become
(transient-define-prefix magit-stgit-undo (&optionalmenu)
"Undo a previous stack operation.":man-page"stg-undo"
["Arguments"
("-n""Undo the last N operations""--number=":reader (lambda (prompt_initial-inputhistory)
(number-to-string (read-number prompt nil history))))
("-h""Discard changes in index/worktree""--hard")]
["Actions"
("z""Undo" magit-stgit-undo)]
(interactive (list (not (eq transient-current-command 'magit-stgit-undo))))
(ifmenu
(transient-setup 'magit-stgit-undo)
(apply#'magit-run-stgit"undo" (transient-args 'magit-stgit-undo))))
That's what I consider the canonical way to implement such commands. It would also have the benefit benefit that there no longer would be any commands that use the magit-stgit-- prefix, which is intended only for internal functions, and certainly not commands. (Of course the latter could also be addressed using magit-stgit-do-ACTION.)
You would lose the ability to call the magit-stgit--ACTION functions from code, but I assume that might not actually be something you wanted to make possible and just fell out of the implementation.
For a few commands this would be a bit more complicated. It appears that you do want to enable delete and goto without going through the menu. You could do that using interactive forms looking like:
You could merge do-it commands into the respective menu commands.
This, for example:
would become
That's what I consider the canonical way to implement such commands. It would also have the benefit benefit that there no longer would be any commands that use the
magit-stgit--
prefix, which is intended only for internal functions, and certainly not commands. (Of course the latter could also be addressed usingmagit-stgit-do-ACTION
.)You would lose the ability to call the
magit-stgit--ACTION
functions from code, but I assume that might not actually be something you wanted to make possible and just fell out of the implementation.For a few commands this would be a bit more complicated. It appears that you do want to enable
delete
andgoto
without going through the menu. You could do that usinginteractive
forms looking like:The text was updated successfully, but these errors were encountered: