Permalink
Browse files

Merge branch 'master' of github.com:josip/kano

Conflicts:
	io/Utilites.io
  • Loading branch information...
2 parents 0d52b89 + d5c9b24 commit 94c3f588af624acc2bba9f8800eab79bb205e3b9 @josip committed May 1, 2010
Showing with 33 additions and 2 deletions.
  1. +8 −2 io/Kano.io
  2. +25 −0 io/Utilites.io
View
@@ -31,11 +31,17 @@ Kano := Object clone do(
ns := Namespaces getSlot(nsName)
ns isNil ifTrue(
Exception raise("Unknown namespace: " .. nsName .. ". Try -ns option"))
+
+ # If only namespace name is provided, "list" task
+ # should be called.
+ ns hasLocalSlot(taskName) ifFalse(
+ taskName = "list")
if(ns hasLocalSlot(taskName),
if(ns getSlot(taskName) type == "Block",
- ns getSlot(taskName) performWithArgList("call", taskArgs)),
- Exception raise("Unknown task: " .. taskName)))
+ ns getSlot(taskName) performWithArgList("call", taskArgs))
+ ,
+ Exception raise("Unknown task: " .. taskName)))
findKanofiles := method(dir,
dir isNil ifTrue(return(list()))
View
@@ -0,0 +1,25 @@
+/*doc Sequence colourize(colour[, option])
+Prints the string to stdout with bash colors.<br/>
+Example: "Fire!!!" colourize("red", "bold") printlnColours
+*/
+Sequence colours := list("black", "red", "green", "yellow", "blue", "purple", "cyan", "white")
+Sequence colourize := method(colour, option,
+ out := "\\e[" asMutable
+ if(colour isNil, out appendSeq("0;3"))
+ if(option == "bold", out appendSeq("1;3"))
+ if(option == "underline", out appendSeq("4;3"))
+ if(option == "background", out appendSeq("4"))
+
+ out appendSeq(self colours indexOf(colour) .. "m")
+ out appendSeq(self)
+ out appendSeq("\\e[0m")
+
+ out)
+
+(System platform asLowercase == "darwin") ifFalse(
+ Sequence colourize = method(self))
+
+Sequence printlnColours := method(
+ System system("echo \"#{self}\"" interpolate)
+ self)
+

0 comments on commit 94c3f58

Please sign in to comment.