chatgpt-shell icon indicating copy to clipboard operation
chatgpt-shell copied to clipboard

Interference of shell-maker

Open theldoria opened this issue 1 year ago • 2 comments

Found the hidden shell-maker gem and it was the perfect fit for my own shell.

However, I immediately stumbled over default, built in "commands" like help and config. They are useful and not many, however especially config interferes with my own use case, because I have a "real" config command meaning something different.

Also help is technically in the way.

If I could remap those to different commands in the config I could overcome this issue...

theldoria avatar Feb 08 '24 11:02 theldoria

If anyone may need it, this is my current workaround:

(defun om-shell-maker--eval-input (orig-func &rest args)
  "Around advice for shell-maker--eval-input."
  (cl-flet (((symbol-function 'shell-maker--curl-version-supported) (lambda () t)))
    (let ((input (car args)))
      (setcar args
              (if (string-prefix-p "$" input)
                  (substring input 1)
                (if (string-equal input "clear")
                    input
                  (concat "$" input))))
      (apply orig-func args))))

(advice-add 'shell-maker--eval-input :around 'om-shell-maker--eval-input)

and in my execute function I remove the first char:

(defun om-shell-execute (command _history callback error-callback)
  "Execute om command"
  (funcall callback
           (om-shell-execute-worker
            (concat "git om " (substring command 1)))
           nil))

(defvar om-shell--config
  (make-shell-maker-config
   :name "om"
   :execute-command 'om-shell-execute))

theldoria avatar Feb 08 '24 13:02 theldoria

Hey, sorry for the late response... I've been meaning to do this item also. I'll try to get to it soon.

xenodium avatar Mar 17 '24 10:03 xenodium