abra-code / OMC

OnMyCommand
http://www.abracode.com/free/cmworkshop/on_my_command.html
MIT License
33 stars 5 forks source link

Add exe_script_file execution mode #2

Closed abra-code closed 5 years ago

abra-code commented 5 years ago

The idea is to move the scripts out of plist into separate files. When building an applet with many scripts, the Command.plist gets too big and messy. Requires exporting all env variables. The script file could be specified explicitly in a separate tag in the command description in the plist or a file could be fo the same name as the command ID. The extension would dictate the popen shell to use for execution. E.g: .sh -> /bin/sh .zsh -> /bin/zsh .pl -> /usr/bin/perl .py -> /usr/bin/python .js -> /System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Resources/jsc (or more advanced JavaScriptCore internal support if need be) .scpt, .applescript -> /usr/bin/osascript (or internal AppleScript support)

abra-code commented 5 years ago

For cleanness, the default location for scripts should be Applet.app/Contents/Resources/Scripts Allow user ot override and specify their own name and location.

abra-code commented 5 years ago

Main commit to implement this feature: https://github.com/abra-code/OMC/commit/f7e3cc127b6fd49b14dfdfef10467b0f7a2d5ee8

Script paths cache improvement: https://github.com/abra-code/OMC/commit/44d9b11cc55e1001e8a7d5dad106c78ec9945d61

abra-code commented 5 years ago

And a bug fix to actually make it work for non .sh scripts: https://github.com/abra-code/OMC/commit/74f92789aded7c073d3d284f47021105e4fa1377