-
Notifications
You must be signed in to change notification settings - Fork 819
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #691 from chrisallenlane/4.3.0
4.3.0
- Loading branch information
Showing
67 changed files
with
183 additions
and
174 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,11 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/cheat/cheat/internal/config" | ||
) | ||
|
||
func cmdConf(opts map[string]interface{}, conf config.Config) { | ||
fmt.Println(conf.Path) | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,18 +1,21 @@ | ||
module github.com/cheat/cheat | ||
|
||
go 1.14 | ||
go 1.19 | ||
|
||
require ( | ||
github.com/alecthomas/chroma v0.10.0 | ||
github.com/davecgh/go-spew v1.1.1 | ||
github.com/dlclark/regexp2 v1.7.0 // indirect | ||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 | ||
github.com/kr/text v0.2.0 // indirect | ||
github.com/mattn/go-isatty v0.0.14 | ||
github.com/mitchellh/go-homedir v1.1.0 | ||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect | ||
golang.org/x/sys v0.0.0-20220731174439-a90be440212d // indirect | ||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect | ||
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 | ||
gopkg.in/yaml.v2 v2.4.0 | ||
) | ||
|
||
require ( | ||
github.com/dlclark/regexp2 v1.7.0 // indirect | ||
github.com/kr/text v0.2.0 // indirect | ||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect | ||
golang.org/x/sys v0.0.0-20220804214406-8e32c043e418 // indirect | ||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect | ||
) |
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
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,30 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
"runtime" | ||
) | ||
|
||
// Editor attempts to locate an editor that's appropriate for the environment. | ||
func Editor() (string, error) { | ||
|
||
// default to `notepad.exe` on Windows | ||
if runtime.GOOS == "windows" { | ||
return "notepad", nil | ||
} | ||
|
||
// look for `nano` on the `PATH` | ||
nano, _ := exec.LookPath("nano") | ||
|
||
// search for `$VISUAL`, `$EDITOR`, and then `nano`, in that order | ||
for _, editor := range []string{os.Getenv("VISUAL"), os.Getenv("EDITOR"), nano} { | ||
if editor != "" { | ||
return editor, nil | ||
} | ||
} | ||
|
||
// return an error if no path is found | ||
return "", fmt.Errorf("no editor set") | ||
} |
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,26 @@ | ||
package config | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
) | ||
|
||
// Pager attempts to locate a pager that's appropriate for the environment. | ||
func Pager() string { | ||
|
||
// if $PAGER is set, return the corresponding pager | ||
if os.Getenv("PAGER") != "" { | ||
return os.Getenv("PAGER") | ||
} | ||
|
||
// Otherwise, search for `pager`, `less`, and `more` on the `$PATH`. If | ||
// none are found, return an empty pager. | ||
for _, pager := range []string{"pager", "less", "more"} { | ||
if path, err := exec.LookPath(pager); err != nil { | ||
return path | ||
} | ||
} | ||
|
||
// default to no pager | ||
return "" | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.