1 class CodaCli < Formula
2 include Language::Python::Shebang
4 desc "Shell integration for Panic's Coda"
5 homepage "http://justinhileman.info/coda-cli/"
6 url "https://github.com/bobthecow/coda-cli/archive/refs/tags/v1.0.5.tar.gz"
7 sha256 "5ed407313a8d1fc6cc4d5b1acc14a80f7e6fad6146f2334de510e475955008b9"
12 sha256 cellar: :any_skip_relocation, all: "483e4c98217844164a568e721fa48ab165e16c6649b3320c2f7811850c1504cb"
15 # originally written in py2, and has not been updated since 2012-05-30
16 deprecate! date: "2024-08-03", because: :unmaintained
18 uses_from_macos "python"
20 # update to use python3
24 rewrite_shebang detected_python_shebang(use_python_from_path: true), "coda"
29 system bin/"coda", "-h"
34 diff --git a/coda b/coda
35 index 2f36414..704adae 100755
38 @@ -49,13 +49,13 @@ License:
39 Distributed under the MIT License - http://creativecommons.org/licenses/MIT/
42 -import sys, os, time, commands, optparse, signal
43 +import sys, os, time, subprocess, optparse, signal
44 from tempfile import mkstemp
45 from pipes import quote
49 -if commands.getoutput("mdfind \"kMDItemCFBundleIdentifier == 'com.panic.Coda2'\"") != "":
50 +if subprocess.getoutput("mdfind \"kMDItemCFBundleIdentifier == 'com.panic.Coda2'\"") != "":
51 bundle_id = 'com.panic.Coda2'
53 bundle_id = 'com.panic.Coda'
54 @@ -81,7 +81,7 @@ parser.version = "%%prog: %s" % version
55 signal.signal(signal.SIGINT, lambda *x: sys.exit(1))
58 - return commands.getoutput("osascript 2>/dev/null <<ENDSCRIPT\n%s\nENDSCRIPT\n:" % scpt)
59 + return subprocess.getoutput("osascript 2>/dev/null <<ENDSCRIPT\n%s\nENDSCRIPT\n:" % scpt)
61 def coda_is_running():
62 return osascript("tell application \"System Events\" to (count (every process whose creator type is \"TStu\")) as boolean") == "true"
63 @@ -107,7 +107,7 @@ def open_tabs():
64 """ % (bundle_id, guts)
67 - return [os.path.realpath(tab) for tab in filter(lambda a: a != "missing value" and a != "", osascript(scpt).rstrip("\n").split("\n"))]
68 + return [os.path.realpath(tab) for tab in [a for a in osascript(scpt).rstrip("\n").split("\n") if a != "missing value" and a != ""]]
72 @@ -135,7 +135,7 @@ if options.version:
76 - print "\n".join(tabs)
77 + print("\n".join(tabs))
80 if options.new_window and coda_is_running():