Przeglądaj źródła

Separate a file for appengine

Copied `colorable_others.go`
ikedam 8 lat temu
rodzic
commit
9a022b4601
2 zmienionych plików z 29 dodań i 1 usunięć
  1. 27 0
      colorable_appengine.go
  2. 2 1
      colorable_others.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
+}

+ 2 - 1
colorable_others.go

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