jackett 0.22.1382
[Homebrew/homebrew-core.git] / Formula / c / coda-cli.rb
blobd1102a15c924e86296b4a6d5126d29ec0439accb
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"
8   license "MIT"
10   bottle do
11     rebuild 1
12     sha256 cellar: :any_skip_relocation, all: "483e4c98217844164a568e721fa48ab165e16c6649b3320c2f7811850c1504cb"
13   end
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
21   patch :DATA
23   def install
24     rewrite_shebang detected_python_shebang(use_python_from_path: true), "coda"
25     bin.install "coda"
26   end
28   test do
29     system bin/"coda", "-h"
30   end
31 end
33 __END__
34 diff --git a/coda b/coda
35 index 2f36414..704adae 100755
36 --- a/coda
37 +++ b/coda
38 @@ -49,13 +49,13 @@ License:
39      Distributed under the MIT License - http://creativecommons.org/licenses/MIT/
41  """
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
47  version = '1.0.5'
49 -if commands.getoutput("mdfind \"kMDItemCFBundleIdentifier == 'com.panic.Coda2'\"") != "":
50 +if subprocess.getoutput("mdfind \"kMDItemCFBundleIdentifier == 'com.panic.Coda2'\"") != "":
51      bundle_id = 'com.panic.Coda2'
52  else:
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))
57  def osascript(scpt):
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)
66      if coda_is_running():
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 != ""]]
69      else:
70          return []
72 @@ -135,7 +135,7 @@ if options.version:
73  if options.lstabs:
74      tabs = open_tabs()
75      if tabs:
76 -        print "\n".join(tabs)
77 +        print("\n".join(tabs))
78      exit()
80  if options.new_window and coda_is_running():