chatgpt-shell
chatgpt-shell copied to clipboard
Interference of shell-maker
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...
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))
Hey, sorry for the late response... I've been meaning to do this item also. I'll try to get to it soon.