Skip to content

Commit

Permalink
Update some stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwinton committed Aug 27, 2019
1 parent 805167c commit 4158a30
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1 +1,3 @@
*.sw*
.DS_Store
node_modules
1 change: 1 addition & 0 deletions getReviewer.py
Expand Up @@ -50,6 +50,7 @@ def main(argv=None):
print("Patch source: %s" % args[0])

changedFiles = fileRe.findall(diff)
print("Changed files: " + str(changedFiles))
changes = {}
for changedFile in changedFiles:
changes[changedFile] = []
Expand Down
Binary file added prompt
Binary file not shown.
106 changes: 106 additions & 0 deletions prompt-js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions prompt-js/package.json
@@ -0,0 +1,16 @@
{
"name": "prompt",
"version": "1.0.0",
"description": "A prompt for me.",
"main": "prompt.js",
"dependencies": {
"clockmoji": "1.0.2",
"moonmoji": "0.0.5"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "bwinton@latte.ca",
"license": "MPL-2"
}
6 changes: 6 additions & 0 deletions prompt-js/prompt.js
@@ -0,0 +1,6 @@
#!/usr/bin/env node

var clockmoji = require('clockmoji');
var moonmoji = require('moonmoji');

console.log(`${moonmoji().emoji} ${clockmoji()} `);
53 changes: 38 additions & 15 deletions weeklyStatus.py
Expand Up @@ -2,6 +2,7 @@
# coding=UTF-8

import appscript
import datetime
import re
import subprocess
import sys
Expand All @@ -16,11 +17,17 @@ class StdoutView(object):
def insert(self, edit, region, data):
sys.stdout.write(data)

# Coordination!
coordination = [
"Talk to Shorlander about search prototype ideas."
]


class WeeklyStatusCommand(sublime_plugin.TextCommand):
def __init__(self):
def __init__(self, showWeek):
self.indent = 0
self.insert = []
self.showWeek = showWeek

def print_name(self, key, suffix=""):
self.insert.append(self.indent * " " + "* ")
Expand All @@ -30,20 +37,28 @@ def print_name(self, key, suffix=""):
def gather_todos(self, things, list, future=False):
todos = things.lists.ID(list)().to_dos()
rv = {}
days = 1
today = datetime.date.today()
if today.weekday() == 0:
days = 3
if self.showWeek:
days = 27
yesterday = datetime.datetime.combine(
today - datetime.timedelta(days=days),
datetime.time(0))
for todo in todos:
if todo.name() == "Update my status!":
if len(rv) > 0 and not future:
if not future and self.showWeek:
break
else:
continue
continue
if not future and todo.completion_date() < yesterday:
break
if self.mozTag in todo.tags():
area = ""
if todo.project():
area = todo.project.name()
elif todo.area():
area = todo.area.name()
elif "meeting" in todo.name().lower() or "talk to" in todo.name().lower():
area = "Meetings"
if area == "":
area = "Work"
rv.setdefault(area, []).append(todo)
Expand All @@ -55,6 +70,8 @@ def print_area(self, area, values):
self.indent += 2
values.reverse()
else:
self.print_name("Other:")
self.indent += 2
values.sort(key=lambda v: v.name())
# coallesce items that contain "bug", and start with the same prefix.
names = []
Expand All @@ -79,8 +96,8 @@ def print_area(self, area, values):

for name in names:
self.print_name(name)
if area != "Work":
self.indent -= 2
self.indent -= 2
self.insert.append('\n')

def run(self, edit):
things = appscript.app("Things")
Expand All @@ -91,27 +108,33 @@ def run(self, edit):
self.mozTag = tag
break

self.insert.append("-----------------\n\n");
self.insert.append("-----------------\n\n")
areas = self.gather_todos(things, u"FocusLogbook")
for area in sorted(areas.keys()):
self.print_area(area, areas[area])

self.insert.append("\n-----------------\n\n");
self.insert.append("-----------------\n\n")
areas = self.gather_todos(things, u"FocusToday", True)
for area in sorted(areas.keys()):
self.print_area(area, areas[area])

self.insert.append("\n-----------------\n");
self.insert.append("-----------------\n\n")
self.insert.extend(["* %s\n" % person for person in coordination])

self.insert.append("-----------------\n")

self.insert = u"".join([x.decode("utf-8") for x in self.insert])
# self.insert = self.insert.replace(u"…", u"...").replace(u"”", u'"').replace(u"“", u'"')
# self.insert = self.insert.replace(u"…", u"...").replace(u"”", u'"')
# .replace(u"“", u'"')
self.view.insert(edit, 0, "".join(self.insert))


class HgPdiffCommand(sublime_plugin.TextCommand):
def run(self, edit):
process = subprocess.Popen('cd ' + self.view.window().folders()[0] + ';/usr/local/bin/hg pdiff',
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
process = subprocess.Popen('cd ' + self.view.window().folders()[0] +
';/usr/local/bin/hg pdiff', shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = process.communicate()
if process.returncode == 0:
self.view.insert(edit, 0, out)
Expand All @@ -121,6 +144,6 @@ def run(self, edit):
self.view.set_syntax_file(u'Packages/Text/Plain text.tmLanguage')

if __name__ == "__main__":
cmd = WeeklyStatusCommand()
cmd = WeeklyStatusCommand(sys.argv[-1] != "-d")
cmd.view = StdoutView()
cmd.run(None)

0 comments on commit 4158a30

Please sign in to comment.