How would you put an AppleScript script under version control?

后端 未结 4 1539
深忆病人
深忆病人 2020-12-13 02:25

I was wondering if this was the best solution:

  • Put the .applescript files under version control
  • Create an installation script to compile the files wit
4条回答
  •  执念已碎
    2020-12-13 02:48

    I love @DanielTrebbien's solution, but it is a little too complex for me to expect people to implement in order to use for my github project. A simpler option that just empowers you to see text changes in the diff is to tell the diff process to textconv with osadecompile.

    Add to .gitattributes

    *.scpt diff=scpt
    

    Add to .git/config

    [diff "scpt"]
      textconv = osadecompile
      binary=true
    

    Here is sample diff from my AppleScript-droplet github project

    $ git diff
    --- a/AppleScript-droplet.app/Contents/Resources/Scripts/main.scpt
    +++ b/AppleScript-droplet.app/Contents/Resources/Scripts/main.scpt
    @@ -1,3 +1,3 @@
    -on open filelist
    -       ## Set useTerminal to true to run the script in a terminal
    -       set useTerminal to true
    +on open file_list
    +       ## Set use_terminal to true to run the script in a terminal
    +       set use_terminal to true
    

    Big thanks to @DanielTrebbien for his answer that lead me to osadecompile.

提交回复
热议问题