-
Notifications
You must be signed in to change notification settings - Fork 5
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
[Feature] Hooks feedback & activation on individual files #25
Comments
This is a... workaround?... if you will, but I'll trigger notifications via osascript a lot to keep my sanity on if I've coded things correctly in hooks, such as correct criteria and/or error capturing. To capture errors, push the stderr to the stdout, then use good o'l /dev/null: err="$(ehco 'blah' 2>&1 1>/dev/null)"
if [ -n "$err" ]; then
osascript -e "display notification \"$err\" with title \"Hook Script Error\""
fi The above I've typo'd And if you want validation on both err and success you could else it via: err="$(echo 'blah' 2>&1 1>/dev/null)"
if [ -n "$err" ]; then
osascript -e "display notification \"$err\" with title \"Hook Script Error\""
else
osascript -e "display notification \"SUCCESS! My code ain't broke!!\" with title \"Woot!\""
fi |
Implemented for Beta 2. Here's how it works: For Bash Hooks:You will see messages in the Log when any of these circumstances are met:
Note:If it's amateur hour and you return For AppleScript Hooks:There is a new API in the scripting dictionary for Beta 2. You can use this to log any message with any error level (regular, warning, or "problem" --- because |
I should also mention an important implementation detail. Suppose you highlight 5 files in CodeKit and click The way CodeKit works, all five of these files will be processed using the settings you've specified in the app (syntax check, transpile, minify, etc.) BEFORE any Hooks are run. That is, the Hook is run at the end of the group of files being processed, not after each individual file is processed. When the build process is complete, this will still apply. During a build, files will be "grouped" based on their dependencies. If This is basically for performance reasons. |
Nice! I'll try to give this a go on next release! Great addition. |
Quick, short summary:
First of all, I have to say that hooks were awesome in CK2 and are even more useful in CK3. Being able to process any file type (an thus trigger a hook) helps a lot. For example, I have a transpiler I made to make useful JSON files out of XML schema files I have no control over. I used to have to change the .xml extensions and process it as another type of file in CK2. It's nice to work with the file natively now. Two minor suggested enhancements for how Hooks work:
Pipe bash/terminal feedback to a codekit screen. Right now, if you have a bug in a hook script, you have no feedback what is causing an error. I am not a bash expert, or even a good speller, so I make a lot of mistakes. It would be nice to have the option to see what you might otherwise see in a terminal window after executing commands so it is easier to debug and see status. I understand that hooks can't be interactive, but a little feedback would help.
Trigger hooks on specific files in the files tab. Currently, you determine when a hook is triggered using the series of pull down options (name/path->matches/contains/end in/etc) in the settings -> hooks tab. If you want to process a specific file or set of files, you have to make sure you use a set of descriptors that match the file(s) you want and not others you don't want to trigger the hook. This requires naming conventions and coordination between the rules and files. It can also become brittle when names and paths change. It would be nice to have another option in the files tab "when this file changes or builds, activate hook". This will allow you to easily apply the hook to a file, change the filename, process other files, and not have to constantly coordinate descriptors.
Good stuff in CK3!!
Expected results:
Ability to see bash/terminal results of running hooks. Ability to apply hooks to individual files.
Actual results:
No terminal feedback. Use a series of file/path descriptors to trigger hooks.
Exact steps to reproduce:
A link to download a simplified project or file that shows the issue:
Your configuration (any details about your system that you think might be relevant)
Codekit 3.0 build 23903
The text was updated successfully, but these errors were encountered: