-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* enable ANSI on Windows * fix for TERM not being set on Windows * rename * remove superfluous flush * move EnableANSI to commands
- Loading branch information
Showing
9 changed files
with
77 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package command | ||
|
||
import "fmt" | ||
|
||
type ExitCode int | ||
|
||
func (e ExitCode) Error() string { | ||
return fmt.Sprintf("exit code %d", e) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package local | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package local | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package term | ||
|
||
import "os" | ||
|
||
func EnableANSI() func() { | ||
return func() {} | ||
} | ||
|
||
func isTerminal() bool { | ||
return os.Getenv("TERM") != "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//go:build windows | ||
// +build windows | ||
|
||
package term | ||
|
||
import ( | ||
"github.com/muesli/termenv" | ||
) | ||
|
||
func EnableANSI() func() { | ||
mode, err := termenv.EnableWindowsANSIConsole() | ||
if err != nil { | ||
return func() {} | ||
} | ||
return func() { | ||
termenv.RestoreWindowsConsole(mode) | ||
} | ||
} | ||
|
||
func isTerminal() bool { | ||
return true | ||
} |