Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2022 c9845 (github.com/c9845)
Copyright (c) 2022 HamidAtPressPage (github.com/HamidAtPressPage)
Copyright (c) 2014 Andrea Franz (http://gravityblast.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fresher is designed for use during development to remove the need to run `go run


# Installing:
Run `go install github.com/c9845/fresher@latest`.
Run `go install github.com/HamidAtPressPage/fresher@latest`.


# Usage:
Expand Down
9 changes: 8 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"strings"
"time"

"github.com/c9845/fresher/version"
"github.com/HamidAtPressPage/fresher/version"
"gopkg.in/yaml.v2"
)

Expand Down Expand Up @@ -135,6 +135,8 @@ type File struct {
//diagnostic output (i.e.: path to config file) when a config file wasn't used
//since if a config file wasn't used, there is no path to log out!
usingBuiltInDefaults bool `yaml:"-"`

DisableLogging bool `yaml:"DisableLogging"`
}

// parsedConfig is the data parsed from the config file. This data is stored so that
Expand Down Expand Up @@ -167,6 +169,7 @@ func newDefaultConfig() (f *File) {
GoTrimpath: true, //probably unnecessary since the built binary shouldn't be used for production or distribution.
Flags: "", //
Verbose: false, //will be overriden by flag to fresher.
DisableLogging: false,

usingBuiltInDefaults: true,
}
Expand Down Expand Up @@ -525,6 +528,10 @@ func (conf *File) OverrideVerbose(v bool) {
conf.Verbose = v
}

func (conf *File) OverrideDisableLogging(v bool) {
conf.DisableLogging = v
}

// isStringInSlice checks if needle is in haystack.
//
// We could use the experimental generic slices.Contains() function, but since we are
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/c9845/fresher
module github.com/HamidAtPressPage/fresher

go 1.19

Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"os"
"strings"

"github.com/c9845/fresher/config"
"github.com/c9845/fresher/runner3"
"github.com/c9845/fresher/version"
"github.com/HamidAtPressPage/fresher/config"
"github.com/HamidAtPressPage/fresher/runner3"
"github.com/HamidAtPressPage/fresher/version"
)

func main() {
Expand Down
6 changes: 5 additions & 1 deletion runner3/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/c9845/fresher/config"
"github.com/HamidAtPressPage/fresher/config"
"github.com/mattn/go-colorable"
)

Expand Down Expand Up @@ -72,6 +72,10 @@ func newLogger(prefix, color string) coloredLogger {

// Printf calls log.Printf with color sequences surrounding some of the text.
func (c *coloredLogger) Printf(format string, v ...interface{}) {
if config.Data().DisableLogging {
return
}

resetCode := fmt.Sprintf("\033[%sm", "0")

format = fmt.Sprintf("%s%s |%s %s", c.colorCode, c.prefix, resetCode, format)
Expand Down
2 changes: 1 addition & 1 deletion runner3/runner3.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"strings"
"time"

"github.com/c9845/fresher/config"
"github.com/HamidAtPressPage/fresher/config"
"github.com/fsnotify/fsnotify"
)

Expand Down