Browse Source

Merge pull request #20 from ikedam/feature/appengine

Make buildable on Windows + goapp
mattn 8 years ago
parent
commit
a392f450ea
3 changed files with 31 additions and 0 deletions
  1. 27 0
      colorable_appengine.go
  2. 1 0
      colorable_others.go
  3. 3 0
      colorable_windows.go

+ 27 - 0
colorable_appengine.go

@@ -0,0 +1,27 @@
+// +build appengine
+
+package colorable
+
+import (
+	"io"
+	"os"
+)
+
+// NewColorable return new instance of Writer which handle escape sequence.
+func NewColorable(file *os.File) io.Writer {
+	if file == nil {
+		panic("nil passed instead of *os.File to NewColorable()")
+	}
+
+	return file
+}
+
+// NewColorableStdout return new instance of Writer which handle escape sequence for stdout.
+func NewColorableStdout() io.Writer {
+	return os.Stdout
+}
+
+// NewColorableStderr return new instance of Writer which handle escape sequence for stderr.
+func NewColorableStderr() io.Writer {
+	return os.Stderr
+}

+ 1 - 0
colorable_others.go

@@ -1,4 +1,5 @@
 // +build !windows
+// +build !appengine
 
 package colorable
 

+ 3 - 0
colorable_windows.go

@@ -1,3 +1,6 @@
+// +build windows
+// +build !appengine
+
 package colorable
 
 import (