Skip to content

Commit ba039ea

Browse files
committed
fix: don't output coloured scopes when not writing to a tty
1 parent 0d2e1e8 commit ba039ea

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Bit - A simple yet powerful build tool [![CI](https://github.com/alecthomas/bit/actions/workflows/ci.yml/badge.svg)](https://github.com/alecthomas/bit/actions/workflows/ci.yml)
22

3+
4+
35
![Build IT](bit.png)
46

57
Bit's goal is to be a simple yet powerful local build system. It is inspired

engine/colours.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ package engine
33
import (
44
"fmt"
55
"hash/fnv"
6+
"os"
67
"strconv"
8+
9+
"github.com/mattn/go-isatty"
710
)
811

912
var (
1013
colours = func() []string {
14+
if !isatty.IsTerminal(os.Stdout.Fd()) {
15+
return []string{""}
16+
}
1117
rgb256Colours := []string{"000000", "008000", "808000", "000080", "800080", "008080", "c0c0c0",
1218
"00ff00", "ffff00", "0000ff", "ff00ff", "00ffff", "ffffff", "000000", "00005f", "000087", "0000af",
1319
"0000d7", "0000ff", "005f00", "005f5f", "005f87", "005faf", "005fd7", "005fff", "008700", "00875f",

engine/internal/glob.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func NewGlobber(dir string, extraFiles func() []string) (*Globber, error) {
2626
if err != nil && !errors.Is(err, fs.ErrNotExist) {
2727
return nil, err
2828
}
29+
ignore = append(ignore, "**/.*")
2930
for i, glob := range ignore {
3031
if strings.HasPrefix(glob, "!") {
3132
ignore[i] = glob[1:]

0 commit comments

Comments
 (0)