You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/08/26 20:25:17 UTC
[10/18] tinkerpop git commit: replaced tabs with space for @pluradj
replaced tabs with space for @pluradj
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/72a54f59
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/72a54f59
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/72a54f59
Branch: refs/heads/master
Commit: 72a54f5921be5c8e75feaa84bbc24dd6f82617cf
Parents: 2297100
Author: Robert Dale <ro...@gmail.com>
Authored: Fri Aug 19 16:52:22 2016 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Fri Aug 19 16:52:22 2016 -0400
----------------------------------------------------------------------
.../tinkerpop/gremlin/console/Console.groovy | 128 +++++++++----------
1 file changed, 64 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/72a54f59/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
index c0db789..896cdf5 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
@@ -73,43 +73,43 @@ class Console {
private static final int DEFAULT_ITERATION_MAX = 100
private static int maxIteration = DEFAULT_ITERATION_MAX
- public static final String PREF_GREMLIN_COLOR = "gremlin.color"
+ public static final String PREF_GREMLIN_COLOR = "gremlin.color"
def gremlinColor = { Preferences.get(PREF_GREMLIN_COLOR, "reset") }
-
- public static final String PREF_VERTEX_COLOR = "vertex.color"
- def vertexColor = { Preferences.get(PREF_VERTEX_COLOR, "reset") }
-
- public static final String PREF_EDGE_COLOR = "edge.color"
- def edgeColor = { Preferences.get(PREF_EDGE_COLOR, "reset") }
-
- public static final String PREF_ERROR_COLOR = "error.color"
+
+ public static final String PREF_VERTEX_COLOR = "vertex.color"
+ def vertexColor = { Preferences.get(PREF_VERTEX_COLOR, "reset") }
+
+ public static final String PREF_EDGE_COLOR = "edge.color"
+ def edgeColor = { Preferences.get(PREF_EDGE_COLOR, "reset") }
+
+ public static final String PREF_ERROR_COLOR = "error.color"
def errorColor = { Preferences.get(PREF_ERROR_COLOR, "reset") }
-
- public static final String PREF_INFO_COLOR = "info.color"
+
+ public static final String PREF_INFO_COLOR = "info.color"
def infoColor = { Preferences.get(PREF_INFO_COLOR, "reset") }
-
- public static final String PREF_STRING_COLOR = "string.color"
- def stringColor = { Preferences.get(PREF_STRING_COLOR, "reset") }
-
- public static final String PREF_NUMBER_COLOR = "number.color"
- def numberColor = { Preferences.get(PREF_NUMBER_COLOR, "reset") }
-
- public static final String PREF_T_COLOR = "T.color"
- def tColor = { Preferences.get(PREF_T_COLOR, "reset") }
-
- public static final String PREF_INPUT_PROMPT_COLOR = "input.prompt.color"
+
+ public static final String PREF_STRING_COLOR = "string.color"
+ def stringColor = { Preferences.get(PREF_STRING_COLOR, "reset") }
+
+ public static final String PREF_NUMBER_COLOR = "number.color"
+ def numberColor = { Preferences.get(PREF_NUMBER_COLOR, "reset") }
+
+ public static final String PREF_T_COLOR = "T.color"
+ def tColor = { Preferences.get(PREF_T_COLOR, "reset") }
+
+ public static final String PREF_INPUT_PROMPT_COLOR = "input.prompt.color"
def inputPromptColor = { Preferences.get(PREF_INPUT_PROMPT_COLOR, "reset") }
-
- public static final String PREF_RESULT_PROMPT_COLOR = "result.prompt.color"
+
+ public static final String PREF_RESULT_PROMPT_COLOR = "result.prompt.color"
def resultPromptColor = { Preferences.get(PREF_RESULT_PROMPT_COLOR, "reset") }
- public static final String PREF_EMPTY_RESULT_IND = "empty.result.indicator"
- def emptyResult = { Preferences.get(PREF_EMPTY_RESULT_IND, "null") }
-
- public static final String PREF_INPUT_PROMPT = "input.prompt"
+ public static final String PREF_EMPTY_RESULT_IND = "empty.result.indicator"
+ def emptyResult = { Preferences.get(PREF_EMPTY_RESULT_IND, "null") }
+
+ public static final String PREF_INPUT_PROMPT = "input.prompt"
def inputPrompt = { Preferences.get(PREF_INPUT_PROMPT, "gremlin>") }
- public static final String PREF_RESULT_PROMPT = "result.prompt"
+ public static final String PREF_RESULT_PROMPT = "result.prompt"
static def resultPrompt = { Preferences.get(PREF_RESULT_PROMPT, "==>") }
private static final String IMPORT_SPACE = "import "
@@ -250,9 +250,9 @@ class Console {
int counter = 0;
while (this.tempIterator.hasNext() && (maxIteration == -1 || counter < maxIteration)) {
final Object object = this.tempIterator.next()
- String prompt = ansiRender(resultPromptColor, buildResultPrompt())
- String colorizedResult = colorizeResult(object)
- io.out.println(prompt + ((null == object) ? emptyResult.call() : colorizedResult))
+ String prompt = ansiRender(resultPromptColor, buildResultPrompt())
+ String colorizedResult = colorizeResult(object)
+ io.out.println(prompt + ((null == object) ? emptyResult.call() : colorizedResult))
counter++;
}
if (this.tempIterator.hasNext())
@@ -310,36 +310,36 @@ class Console {
}
}
}
-
- def colorizeResult = { object ->
- if (object instanceof Vertex) {
- return ansiRender(vertexColor, object.toString())
- } else if (object instanceof Edge) {
- return ansiRender(edgeColor, object.toString())
- } else if (object instanceof Iterable) {
- List<String> buf = new ArrayList<>();
- def pathIter = object.iterator()
- while (pathIter.hasNext()) {
- Object n = pathIter.next()
- buf.add(colorizeResult(n))
- }
- return ("[" + buf.join(",") + "]")
- } else if (object instanceof Map) {
- List<String> buf = new ArrayList<>();
- object.each{k, v ->
- buf.add(colorizeResult(k) + ":" + colorizeResult(v))
- }
- return ("[" + buf.join(",") + "]")
- } else if (object instanceof String) {
- return ansiRender(stringColor, object)
- } else if (object instanceof Number) {
- return ansiRender(numberColor, object)
- } else if (object instanceof T) {
- return ansiRender(tColor, object)
- } else {
- return object.toString()
- }
- }
+
+ def colorizeResult = { object ->
+ if (object instanceof Vertex) {
+ return ansiRender(vertexColor, object.toString())
+ } else if (object instanceof Edge) {
+ return ansiRender(edgeColor, object.toString())
+ } else if (object instanceof Iterable) {
+ List<String> buf = new ArrayList<>();
+ def pathIter = object.iterator()
+ while (pathIter.hasNext()) {
+ Object n = pathIter.next()
+ buf.add(colorizeResult(n))
+ }
+ return ("[" + buf.join(",") + "]")
+ } else if (object instanceof Map) {
+ List<String> buf = new ArrayList<>();
+ object.each{k, v ->
+ buf.add(colorizeResult(k) + ":" + colorizeResult(v))
+ }
+ return ("[" + buf.join(",") + "]")
+ } else if (object instanceof String) {
+ return ansiRender(stringColor, object)
+ } else if (object instanceof Number) {
+ return ansiRender(numberColor, object)
+ } else if (object instanceof T) {
+ return ansiRender(tColor, object)
+ } else {
+ return object.toString()
+ }
+ }
private def handleError = { err ->
this.tempIterator = Collections.emptyIterator();
@@ -433,8 +433,8 @@ class Console {
if (!interactive) System.exit(1)
}
}
-
- def ansiRender = { color, text -> Ansi.ansi().render(String.format("@|%s %s|@", color.call(), text)).toString() }
+
+ def ansiRender = { color, text -> Ansi.ansi().render(String.format("@|%s %s|@", color.call(), text)).toString() }
public static void main(final String[] args) {
// need to do some up front processing to try to support "bin/gremlin.sh init.groovy" until this deprecated