Browse files

Colored outputs

  • Loading branch information...
1 parent 06b305e commit 07991c146dc7b525796130d17e89309ecc4380c5 Tomek Wytrębowicz committed Dec 14, 2012
Showing with 203 additions and 11 deletions.
  1. +47 −0 syntax/Vlt Status.JSON-tmLanguage
  2. +134 −0 syntax/Vlt Status.tmLanguage
  3. +22 −11 vlt.py
View
47 syntax/Vlt Status.JSON-tmLanguage
@@ -0,0 +1,47 @@
+{ "name": "Vlt Status",
+ "scopeName": "text.git-graph",
+ "fileTypes": ["git-graph"],
+ "patterns": [
+
+ { "match": "^((A)|(C)|(U)|(D))\\s+(.*)\\s*(\\([\\w-]+/[\\w-]+\\))?$",
+ "name": "comment.git-graph",
+ "captures": {
+ "1": {"name": "support.constant.git-graph" },
+ "2": {"name": "entity.name.class.git-graph" },
+ "3": {"name": "invalid.git-graph" },
+ "4": {"name": "support.constant.git-graph" },
+ "5": {"name": "keyword.git-graph" },
+ "6": {"name": "string.git-graph" },
+ "7": {"name": "comment.git-graph" },
+ "8": {"name": "constant.numeric.git-graph" },
+ "9": {"name": "variable.parameter.git-graph" }
+ }
+ },
+ { "match": "^done.$",
+ "name": "keyword.git-graph",
+ "comment": "lines with no commit details"
+ },
+ { "match": "^(Collecting commit information\\.+|Transmitting file data\\.+)$",
+ "name": "comment.git-graph",
+ "comment": "lines with no commit details"
+ },
+ { "match": "^Connecting via JCR remoting to (.*)$",
+ "name": "comment.git-graph",
+ "comment": "issue numbers",
+ "captures": {
+ "1": {"name": "variable.parameter.git-graph" }
+ }
+ },
+ { "match": "^((sending)|(deleting))\\.+\\s*(.*)$",
+ "name": "support.function.git-graph",
+ "captures": {
+ "1": {"name": "support.constant.git-graph" },
+ "2": {"name": "support.constant.git-graph" },
+ "3": {"name": "keyword.git-graph" },
+ "4": {"name": "string.git-graph"}
+ }
+ }
+
+ ],
+ "uuid": "fb92236f-e76e-4c59-a65d-a66b4e47a80e"
+}
View
134 syntax/Vlt Status.tmLanguage
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>fileTypes</key>
+ <array>
+ <string>git-graph</string>
+ </array>
+ <key>name</key>
+ <string>Vlt Status</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>captures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>support.constant.git-graph</string>
+ </dict>
+ <key>2</key>
+ <dict>
+ <key>name</key>
+ <string>entity.name.class.git-graph</string>
+ </dict>
+ <key>3</key>
+ <dict>
+ <key>name</key>
+ <string>invalid.git-graph</string>
+ </dict>
+ <key>4</key>
+ <dict>
+ <key>name</key>
+ <string>support.constant.git-graph</string>
+ </dict>
+ <key>5</key>
+ <dict>
+ <key>name</key>
+ <string>keyword.git-graph</string>
+ </dict>
+ <key>6</key>
+ <dict>
+ <key>name</key>
+ <string>string.git-graph</string>
+ </dict>
+ <key>7</key>
+ <dict>
+ <key>name</key>
+ <string>comment.git-graph</string>
+ </dict>
+ <key>8</key>
+ <dict>
+ <key>name</key>
+ <string>constant.numeric.git-graph</string>
+ </dict>
+ <key>9</key>
+ <dict>
+ <key>name</key>
+ <string>variable.parameter.git-graph</string>
+ </dict>
+ </dict>
+ <key>match</key>
+ <string>^((A)|(C)|(U)|(D))\s+(.*)\s*(\([\w-]+/[\w-]+\))?$</string>
+ <key>name</key>
+ <string>comment.git-graph</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>lines with no commit details</string>
+ <key>match</key>
+ <string>^done.$</string>
+ <key>name</key>
+ <string>keyword.git-graph</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>lines with no commit details</string>
+ <key>match</key>
+ <string>^(Collecting commit information\.+|Transmitting file data\.+)$</string>
+ <key>name</key>
+ <string>comment.git-graph</string>
+ </dict>
+ <dict>
+ <key>captures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>variable.parameter.git-graph</string>
+ </dict>
+ </dict>
+ <key>comment</key>
+ <string>issue numbers</string>
+ <key>match</key>
+ <string>^Connecting via JCR remoting to (.*)$</string>
+ <key>name</key>
+ <string>comment.git-graph</string>
+ </dict>
+ <dict>
+ <key>captures</key>
+ <dict>
+ <key>1</key>
+ <dict>
+ <key>name</key>
+ <string>support.constant.git-graph</string>
+ </dict>
+ <key>2</key>
+ <dict>
+ <key>name</key>
+ <string>support.constant.git-graph</string>
+ </dict>
+ <key>3</key>
+ <dict>
+ <key>name</key>
+ <string>keyword.git-graph</string>
+ </dict>
+ <key>4</key>
+ <dict>
+ <key>name</key>
+ <string>string.git-graph</string>
+ </dict>
+ </dict>
+ <key>match</key>
+ <string>^((sending)|(deleting))\.+\s*(.*)$</string>
+ <key>name</key>
+ <string>support.function.git-graph</string>
+ </dict>
+ </array>
+ <key>scopeName</key>
+ <string>text.git-graph</string>
+ <key>uuid</key>
+ <string>fb92236f-e76e-4c59-a65d-a66b4e47a80e</string>
+</dict>
+</plist>
View
33 vlt.py
@@ -1,17 +1,23 @@
# Written by Tomek Wytrebowicz (tomalecpub@gmail.com)
# TODO: vlt add directories (-N non recursive)
-import sublime, sublime_plugin
-
import os
-import stat
-import subprocess
+import sublime
+import sublime_plugin
import tempfile
import threading
-import os.path
+import subprocess
import functools
+import os.path
import time
# Plugin Settings are located in 'vlt.sublime-settings' make a copy in the User folder to keep changes
+
+# when sublime loads a plugin it's cd'd into the plugin directory. Thus
+# __file__ is useless for my purposes. What I want is "Packages/Git", but
+# allowing for the possibility that someone has renamed the file.
+# Fun discovery: Sublime on windows still requires posix path separators.
+PLUGIN_DIRECTORY = os.getcwd().replace(os.path.normpath(os.path.join(os.getcwd(), '..', '..')) + os.path.sep, '').replace(os.path.sep, '/')
+
vlt_root_cache = {}
def vlt_root(directory):
@@ -135,7 +141,6 @@ def run_command(self, command, callback=None, show_status=True,
kwargs['fallback_encoding'] = self.active_view().settings().get('fallback_encoding').rpartition('(')[2].rpartition(')')[0]
s = sublime.load_settings("vlt.sublime-settings")
-
if s.get('save_first') and self.active_view() and self.active_view().is_dirty() and not no_save:
print "vlt[debug] save first"
self.active_view().run_command('save')
@@ -267,7 +272,7 @@ def panel_followup(self, picked_status, picked_file, picked_index):
root = self.get_working_dir()
#get rid of (mime/type)
picked_file = picked_file.split(" (")[0]
- if picked_status == '?' or picked_status == 'A' or s.get('status_opens_file') or self.force_open:
+ if picked_status == '?' or picked_status == 'A' or picked_status == 'C' or s.get('status_opens_file') or self.force_open:
if(os.path.isfile(os.path.join(root, picked_file))): self.window.open_file(os.path.join(root, picked_file))
else:
self.run_command(['vlt', 'diff', picked_file.strip('"')],
@@ -332,7 +337,7 @@ def run(self, edit):
def commit_done(self, result):
if result.strip():
- self.scratch(result, title="Vlt Commit")
+ self.scratch(result, title="Vlt Commit", syntax=plugin_file("syntax/Vlt Status.tmLanguage"))
else:
sublime.status_message("Nothing to show")
@@ -477,7 +482,8 @@ def run(self):
def update_done(self, result):
if result.strip():
- self.scratch(result, title="Vlt Update")
+ self.scratch(result, title="Vlt Update",
+ syntax=plugin_file("syntax/Vlt Status.tmLanguage"))
else:
sublime.status_message("Nothing to show")
@@ -492,7 +498,8 @@ def run(self, edit):
def commit_done(self, result):
if result.strip():
- self.scratch(result, title="Vlt Update")
+ self.scratch(result, title="Vlt Update",
+ syntax=plugin_file("syntax/Vlt Status.tmLanguage"))
else:
sublime.status_message(result)
@@ -531,5 +538,9 @@ def panel_followup(self, picked_status, picked_file, picked_index):
def rerun(self, result):
self.run()
def show_output(self, result):
- self.scratch(result, title="Vlt Revert")
+ self.scratch(result, title="Vlt Revert",
+ syntax=plugin_file("syntax/Vlt Status.tmLanguage"))
+
+def plugin_file(name):
+ return os.path.join(PLUGIN_DIRECTORY, name)

0 comments on commit 07991c1

Please sign in to comment.