Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interference of shell-maker #193

Open
theldoria opened this issue Feb 8, 2024 · 2 comments
Open

Interference of shell-maker #193

theldoria opened this issue Feb 8, 2024 · 2 comments

Comments

@theldoria
Copy link

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
Copy link
Author

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))

@xenodium
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants