2

I understand the infix flags work. However, I'm not sure how best to work with argument inputs. I have read the docs as well as looked at some examples from the magit source code but it's still a little bit beyond me as I need some really basic examples to get me started:

Given these two functions:

(defun say-hi:fn (&optional args)
  (message "%s" (<read-args> args)))

(define-transient-command say-hi ()
  "Say Hi"
  ["Arguments"
   ("-g" "Greeting" "--greeting")
   ("-n" "Name" "--name")]
  ["Actions"
   ("H" "Hi" say-hi:fn)])
  1. How do I customise the default Greeting to be "Hello" and the default Name to be "World"?

  2. How do I define to sample <greeting> and <name> from args?

  3. How do I limit the selection of <greeting> to be one of Hello, Hi and G'day?

  4. How do I hook up <name> to be read from another input source such as counsel or a form widget?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.