Skip to content

Commit

Permalink
rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcai314 committed Nov 5, 2023
1 parent 65ba61d commit f70b1c7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Formula/cowponder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Cowponder < Formula
desc "Simple terminal command to display random philosophical thoughts from a cow"
homepage "https://github.com/maxcai314/homebrew-cowponder"
url "https://max.xz.ax/cowponder/cowponder-homebrew-v0.0.2.tar.gz"
sha256 "4ddfbae2d0bfd305753304f1a7e834e84e5d8f7b2a461cba9f216969dcf83810"
sha256 "9c0fdb7a962c858e69c3d10a6583da79217e13e6dc95fa7418e9e1e7830a0d44"

depends_on "cowsay"
depends_on "python@3"
Expand Down
23 changes: 19 additions & 4 deletions resources/contents/cowponder
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/python3

import argparse
import requests
import subprocess
from random import SystemRandom
from os import path, popen
Expand Down Expand Up @@ -53,14 +54,28 @@ args = vars(ap.parse_args())
if args["help"]:
print(ap.description)
exit()

if args['version']:
subprocess.run(["cowthink", "cowponder version 0.0.1"])
subprocess.run(["brew", "info", "cowponder"])
# print("cowponder version 0.0.1")
exit()

if args['update']:
subprocess.run(["wget", "-q", "-O", cowthoughts_path, "https://raw.githubusercontent.com/maxcai314/cowponder/master/cowponder_0.0.1-1_all/etc/cowthoughts.txt"])
subprocess.run(["cowthink", "updated thoughtbook"])
exit()
try:
response = requests.get('https://max.xz.ax/cowponder/cowthoughts.txt')
if response.status_code == 200:
with open(cowthoughts_path, 'w') as f:
f.write(response.text)
print("updated thoughtbook (moo)")
exit()
else:
print("failed to download cowthoughts.txt")
print("no changes written to local cowthoughts file")
exit()
except Exception as e:
print(f"Error while downloading cowthoughts.txt: {e}")
exit()

if thought := args['add']:
with open(cowthoughts_path, "a") as f:
print(thought, file=f)
Expand Down
29 changes: 18 additions & 11 deletions resources/contents/ponder
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/python3

import argparse
import requests
import subprocess
import os
from random import SystemRandom
Expand All @@ -18,18 +19,24 @@ ap.add_argument("-a", "--add", help="Add custom thought to thoughtbook.")
args = vars(ap.parse_args())

if args['version']:
print("cowponder version 0.0.1")
exit()
if args['update']:
subprocess.run(["wget", "-q", "-O", cowthoughts_path, "https://max.xz.ax/cowponder/cowthoughts.txt"])
print("updated thoughtbook (moo)")
exit()
if thought := args['add']:
with open(cowthoughts_path, "a") as f:
print(thought, file=f)
print('"', thought, '" added to thoughtbook (moo)', sep='')
exit()
subprocess.run(["brew", "info", "cowponder"])
exit()

if args['update']:
try:
response = requests.get('https://max.xz.ax/cowponder/cowthoughts.txt')
if response.status_code == 200:
with open(cowthoughts_path, 'w') as f:
f.write(response.text)
print("updated thoughtbook (moo)")
exit()
else:
print("failed to download cowthoughts.txt")
print("no changes written to local cowthoughts file")
exit()
except Exception as e:
print(f"Error while downloading cowthoughts.txt: {e}")
exit()

with open(cowthoughts_path) as thinkbook:
thoughts = [thought for thought in thinkbook.read().split("\n") if thought]
Expand Down
Binary file modified resources/cowponder-homebrew-v0.0.2.tar.gz
Binary file not shown.

0 comments on commit f70b1c7

Please sign in to comment.