From 86c005e015c8fbd58f5b21fa3001270fd3bf3af4 Mon Sep 17 00:00:00 2001 From: Ben S Date: Tue, 8 Dec 2015 07:29:07 +0000 Subject: [PATCH] Add some Terminal+Cargo AppleScripts --- Contents/Scripts/Cargo/build.applescript | 17 +++++++++++++++++ Contents/Scripts/Cargo/doc.applescript | 17 +++++++++++++++++ Contents/Scripts/Cargo/test.applescript | 17 +++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 Contents/Scripts/Cargo/build.applescript create mode 100644 Contents/Scripts/Cargo/doc.applescript create mode 100644 Contents/Scripts/Cargo/test.applescript diff --git a/Contents/Scripts/Cargo/build.applescript b/Contents/Scripts/Cargo/build.applescript new file mode 100644 index 0000000..ad963b0 --- /dev/null +++ b/Contents/Scripts/Cargo/build.applescript @@ -0,0 +1,17 @@ +tell application "BBEdit" + tell front text document + if modified = true then + save its document + end if + set the_file to its file + if the_file ­ missing value then + set the_path to POSIX path of ((the_file as text) & "::") + else + error "Document does not point to a file" + end if + end tell +end tell + +tell application "Terminal" + do script "cd " & (quoted form of the_path) & "; cargo build" +end tell diff --git a/Contents/Scripts/Cargo/doc.applescript b/Contents/Scripts/Cargo/doc.applescript new file mode 100644 index 0000000..352f3de --- /dev/null +++ b/Contents/Scripts/Cargo/doc.applescript @@ -0,0 +1,17 @@ +tell application "BBEdit" + tell front text document + if modified = true then + save its document + end if + set the_file to its file + if the_file ­ missing value then + set the_path to POSIX path of ((the_file as text) & "::") + else + error "Document does not point to a file" + end if + end tell +end tell + +tell application "Terminal" + do script "cd " & (quoted form of the_path) & "; cargo doc --open" +end tell diff --git a/Contents/Scripts/Cargo/test.applescript b/Contents/Scripts/Cargo/test.applescript new file mode 100644 index 0000000..cfbf35d --- /dev/null +++ b/Contents/Scripts/Cargo/test.applescript @@ -0,0 +1,17 @@ +tell application "BBEdit" + tell front text document + if modified = true then + save its document + end if + set the_file to its file + if the_file ­ missing value then + set the_path to POSIX path of ((the_file as text) & "::") + else + error "Document does not point to a file" + end if + end tell +end tell + +tell application "Terminal" + do script "cd " & (quoted form of the_path) & "; cargo test" +end tell