mirror of
https://github.com/cheat/cheat.git
synced 2025-09-04 02:58:29 +02:00
Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
fe8f39013e | |||
1016b20ef2 | |||
def8985dcd | |||
e6f12147df | |||
a8c2c396ed | |||
35262df4f2 | |||
12ffa4cb5c | |||
d9c602f9e1 | |||
b67ff8b6a8 | |||
a500a621a1 | |||
23b6928874 | |||
9de39fb12b | |||
ad501c4cbe | |||
f17de401e5 | |||
2c097adeda | |||
b825e0f535 | |||
8385277b28 |
@ -35,6 +35,9 @@ Are you unable to do the above, but still want to contribute? You can help
|
|||||||
`cheat` simply by telling others about it. Share it with friends and coworkers
|
`cheat` simply by telling others about it. Share it with friends and coworkers
|
||||||
that might benefit from using it.
|
that might benefit from using it.
|
||||||
|
|
||||||
|
#### Pull Requests ####
|
||||||
|
Please open all pull-requests against the `develop` branch.
|
||||||
|
|
||||||
|
|
||||||
[cheat]: https://github.com/cheat/cheat
|
[cheat]: https://github.com/cheat/cheat
|
||||||
[cheatsheets]: https://github.com/cheat/cheatsheets
|
[cheatsheets]: https://github.com/cheat/cheatsheets
|
||||||
|
7
Makefile
7
Makefile
@ -86,7 +86,7 @@ $(dist_dir)/cheat-linux-arm64: prepare
|
|||||||
# cheat-windows-amd64
|
# cheat-windows-amd64
|
||||||
$(dist_dir)/cheat-windows-amd64.exe: prepare
|
$(dist_dir)/cheat-windows-amd64.exe: prepare
|
||||||
GOARCH=amd64 GOOS=windows \
|
GOARCH=amd64 GOOS=windows \
|
||||||
$(GO) build $(BUILD_FLAGS) -o $@ $(cmd_dir) && $(ZIP) $@.zip $@
|
$(GO) build $(BUILD_FLAGS) -o $@ $(cmd_dir) && $(ZIP) $@.zip $@ -j
|
||||||
|
|
||||||
# ./dist
|
# ./dist
|
||||||
$(dist_dir):
|
$(dist_dir):
|
||||||
@ -180,6 +180,11 @@ prepare: | $(dist_dir) clean generate vendor fmt lint vet test
|
|||||||
docker-setup:
|
docker-setup:
|
||||||
$(DOCKER) build -t $(docker_image) -f Dockerfile .
|
$(DOCKER) build -t $(docker_image) -f Dockerfile .
|
||||||
|
|
||||||
|
## docker-run: shell into the development docker container
|
||||||
|
.PHONY: docker-run
|
||||||
|
docker-run:
|
||||||
|
$(DOCKER) run -v `pwd`:/app -ti $(docker_image) sh
|
||||||
|
|
||||||
## docker-sh: shell into the docker development container
|
## docker-sh: shell into the docker development container
|
||||||
.PHONY: docker-sh
|
.PHONY: docker-sh
|
||||||
docker-sh:
|
docker-sh:
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// This script embeds `docopt.txt and `conf.yml` into the binary during at
|
// This script embeds `docopt.txt and `conf.yml` into the binary during at
|
||||||
@ -5,13 +6,11 @@
|
|||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -52,10 +51,10 @@ func main() {
|
|||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
|
|
||||||
// delete the outfile
|
// delete the outfile
|
||||||
os.Remove(path.Join(root, file.Out))
|
os.Remove(filepath.Join(root, file.Out))
|
||||||
|
|
||||||
// read the static template
|
// read the static template
|
||||||
bytes, err := ioutil.ReadFile(path.Join(root, file.In))
|
bytes, err := ioutil.ReadFile(filepath.Join(root, file.In))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -64,7 +63,7 @@ func main() {
|
|||||||
data := template(file.Method, string(bytes))
|
data := template(file.Method, string(bytes))
|
||||||
|
|
||||||
// write the file to the specified outpath
|
// write the file to the specified outpath
|
||||||
spath := path.Join(root, file.Out)
|
spath := filepath.Join(root, file.Out)
|
||||||
err = ioutil.WriteFile(spath, []byte(data), 0644)
|
err = ioutil.WriteFile(spath, []byte(data), 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/cheat/cheat/internal/cheatpath"
|
"github.com/cheat/cheat/internal/cheatpath"
|
||||||
@ -58,10 +58,10 @@ func cmdEdit(opts map[string]interface{}, conf config.Config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// compute the new edit path
|
// compute the new edit path
|
||||||
editpath = path.Join(writepath.Path, sheet.Title)
|
editpath = filepath.Join(writepath.Path, sheet.Title)
|
||||||
|
|
||||||
// create any necessary subdirectories
|
// create any necessary subdirectories
|
||||||
dirs := path.Dir(editpath)
|
dirs := filepath.Dir(editpath)
|
||||||
if dirs != "." {
|
if dirs != "." {
|
||||||
if err := os.MkdirAll(dirs, 0755); err != nil {
|
if err := os.MkdirAll(dirs, 0755); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "failed to create directory: %s, %v\n", dirs, err)
|
fmt.Fprintf(os.Stderr, "failed to create directory: %s, %v\n", dirs, err)
|
||||||
@ -87,10 +87,10 @@ func cmdEdit(opts map[string]interface{}, conf config.Config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// compute the new edit path
|
// compute the new edit path
|
||||||
editpath = path.Join(writepath.Path, cheatsheet)
|
editpath = filepath.Join(writepath.Path, cheatsheet)
|
||||||
|
|
||||||
// create any necessary subdirectories
|
// create any necessary subdirectories
|
||||||
dirs := path.Dir(editpath)
|
dirs := filepath.Dir(editpath)
|
||||||
if dirs != "." {
|
if dirs != "." {
|
||||||
if err := os.MkdirAll(dirs, 0755); err != nil {
|
if err := os.MkdirAll(dirs, 0755); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "failed to create directory: %s, %v\n", dirs, err)
|
fmt.Fprintf(os.Stderr, "failed to create directory: %s, %v\n", dirs, err)
|
||||||
|
@ -3,7 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -42,11 +42,11 @@ func cmdInit() {
|
|||||||
// determine the appropriate paths for config data and (optional) community
|
// determine the appropriate paths for config data and (optional) community
|
||||||
// cheatsheets based on the user's platform
|
// cheatsheets based on the user's platform
|
||||||
confpath := confpaths[0]
|
confpath := confpaths[0]
|
||||||
confdir := path.Dir(confpath)
|
confdir := filepath.Dir(confpath)
|
||||||
|
|
||||||
// create paths for community and personal cheatsheets
|
// create paths for community and personal cheatsheets
|
||||||
community := path.Join(confdir, "/cheatsheets/community")
|
community := filepath.Join(confdir, "cheatsheets", "community")
|
||||||
personal := path.Join(confdir, "/cheatsheets/personal")
|
personal := filepath.Join(confdir, "cheatsheets", "personal")
|
||||||
|
|
||||||
// template the above paths into the default configs
|
// template the above paths into the default configs
|
||||||
configs = strings.Replace(configs, "COMMUNITY_PATH", community, -1)
|
configs = strings.Replace(configs, "COMMUNITY_PATH", community, -1)
|
||||||
|
@ -25,7 +25,7 @@ func cmdList(opts map[string]interface{}, conf config.Config) {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// filter cheatcheats by tag if --tag was provided
|
// filter cheatsheets by tag if --tag was provided
|
||||||
if opts["--tag"] != nil {
|
if opts["--tag"] != nil {
|
||||||
cheatsheets = sheets.Filter(
|
cheatsheets = sheets.Filter(
|
||||||
cheatsheets,
|
cheatsheets,
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/cheat/cheat/internal/installer"
|
"github.com/cheat/cheat/internal/installer"
|
||||||
)
|
)
|
||||||
|
|
||||||
const version = "4.2.2"
|
const version = "4.2.4"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
@ -45,6 +45,9 @@ func main() {
|
|||||||
envvars := map[string]string{}
|
envvars := map[string]string{}
|
||||||
for _, e := range os.Environ() {
|
for _, e := range os.Environ() {
|
||||||
pair := strings.SplitN(e, "=", 2)
|
pair := strings.SplitN(e, "=", 2)
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
pair[0] = strings.ToUpper(pair[0])
|
||||||
|
}
|
||||||
envvars[pair[0]] = pair[1]
|
envvars[pair[0]] = pair[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,22 +9,23 @@ import (
|
|||||||
func configs() string {
|
func configs() string {
|
||||||
return strings.TrimSpace(`---
|
return strings.TrimSpace(`---
|
||||||
# The editor to use with 'cheat -e <sheet>'. Defaults to $EDITOR or $VISUAL.
|
# The editor to use with 'cheat -e <sheet>'. Defaults to $EDITOR or $VISUAL.
|
||||||
editor: vim
|
# editor: vim
|
||||||
|
|
||||||
# Should 'cheat' always colorize output?
|
# Should 'cheat' always colorize output?
|
||||||
colorize: true
|
colorize: false
|
||||||
|
|
||||||
# Which 'chroma' colorscheme should be applied to the output?
|
# Which 'chroma' colorscheme should be applied to the output?
|
||||||
# Options are available here:
|
# Options are available here:
|
||||||
# https://github.com/alecthomas/chroma/tree/master/styles
|
# https://github.com/alecthomas/chroma/tree/master/styles
|
||||||
style: monokai
|
# style: monokai
|
||||||
|
|
||||||
# Which 'chroma' "formatter" should be applied?
|
# Which 'chroma' "formatter" should be applied?
|
||||||
# One of: "terminal", "terminal256", "terminal16m"
|
# One of: "terminal", "terminal256", "terminal16m"
|
||||||
formatter: terminal16m
|
formatter: terminal
|
||||||
|
|
||||||
# Through which pager should output be piped? (Unset this key for no pager.)
|
# Through which pager should output be piped? (Unset this key for no pager.)
|
||||||
pager: less -FRX
|
pager: more
|
||||||
|
# pager: less -FRX # <- recommended where available
|
||||||
|
|
||||||
# The paths at which cheatsheets are available. Tags associated with a cheatpath
|
# The paths at which cheatsheets are available. Tags associated with a cheatpath
|
||||||
# are automatically attached to all cheatsheets residing on that path.
|
# are automatically attached to all cheatsheets residing on that path.
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
---
|
---
|
||||||
# The editor to use with 'cheat -e <sheet>'. Defaults to $EDITOR or $VISUAL.
|
# The editor to use with 'cheat -e <sheet>'. Defaults to $EDITOR or $VISUAL.
|
||||||
editor: vim
|
# editor: vim
|
||||||
|
|
||||||
# Should 'cheat' always colorize output?
|
# Should 'cheat' always colorize output?
|
||||||
colorize: true
|
colorize: false
|
||||||
|
|
||||||
# Which 'chroma' colorscheme should be applied to the output?
|
# Which 'chroma' colorscheme should be applied to the output?
|
||||||
# Options are available here:
|
# Options are available here:
|
||||||
# https://github.com/alecthomas/chroma/tree/master/styles
|
# https://github.com/alecthomas/chroma/tree/master/styles
|
||||||
style: monokai
|
# style: monokai
|
||||||
|
|
||||||
# Which 'chroma' "formatter" should be applied?
|
# Which 'chroma' "formatter" should be applied?
|
||||||
# One of: "terminal", "terminal256", "terminal16m"
|
# One of: "terminal", "terminal256", "terminal16m"
|
||||||
formatter: terminal16m
|
formatter: terminal
|
||||||
|
|
||||||
# Through which pager should output be piped? (Unset this key for no pager.)
|
# Through which pager should output be piped? (Unset this key for no pager.)
|
||||||
pager: less -FRX
|
pager: more
|
||||||
|
# pager: less -FRX # <- recommended where available
|
||||||
|
|
||||||
# The paths at which cheatsheets are available. Tags associated with a cheatpath
|
# The paths at which cheatsheets are available. Tags associated with a cheatpath
|
||||||
# are automatically attached to all cheatsheets residing on that path.
|
# are automatically attached to all cheatsheets residing on that path.
|
||||||
|
3
go.mod
3
go.mod
@ -7,11 +7,10 @@ require (
|
|||||||
github.com/davecgh/go-spew v1.1.1
|
github.com/davecgh/go-spew v1.1.1
|
||||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
|
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
|
||||||
github.com/kr/text v0.2.0 // indirect
|
github.com/kr/text v0.2.0 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.13
|
github.com/mattn/go-isatty v0.0.14
|
||||||
github.com/mitchellh/go-homedir v1.1.0
|
github.com/mitchellh/go-homedir v1.1.0
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
|
||||||
github.com/sergi/go-diff v1.1.0 // indirect
|
github.com/sergi/go-diff v1.1.0 // indirect
|
||||||
golang.org/x/sys v0.0.0-20210608053332-aa57babbf139 // indirect
|
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
||||||
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0
|
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
|
8
go.sum
8
go.sum
@ -24,8 +24,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
|||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA=
|
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||||
github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||||
@ -45,8 +45,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
|
|||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210608053332-aa57babbf139 h1:C+AwYEtBp/VQwoLntUmQ/yx3MS9vmZaKNdw5eOpoQe8=
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
|
||||||
golang.org/x/sys v0.0.0-20210608053332-aa57babbf139/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||||
|
@ -4,7 +4,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
cp "github.com/cheat/cheat/internal/cheatpath"
|
cp "github.com/cheat/cheat/internal/cheatpath"
|
||||||
@ -98,8 +100,22 @@ func New(opts map[string]interface{}, confPath string, resolve bool) (Config, er
|
|||||||
conf.Editor = os.Getenv("VISUAL")
|
conf.Editor = os.Getenv("VISUAL")
|
||||||
} else if os.Getenv("EDITOR") != "" {
|
} else if os.Getenv("EDITOR") != "" {
|
||||||
conf.Editor = os.Getenv("EDITOR")
|
conf.Editor = os.Getenv("EDITOR")
|
||||||
|
} else if runtime.GOOS == "windows" {
|
||||||
|
conf.Editor = "notepad"
|
||||||
} else {
|
} else {
|
||||||
return Config{}, fmt.Errorf("no editor set")
|
// try to fall back to `nano`
|
||||||
|
path, err := exec.LookPath("nano")
|
||||||
|
if err != nil {
|
||||||
|
return Config{}, fmt.Errorf("failed to locate nano: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// use `nano` if we found it
|
||||||
|
if path != "" {
|
||||||
|
conf.Editor = "nano"
|
||||||
|
// otherwise, give up
|
||||||
|
} else {
|
||||||
|
return Config{}, fmt.Errorf("no editor set")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,12 +126,13 @@ func New(opts map[string]interface{}, confPath string, resolve bool) (Config, er
|
|||||||
|
|
||||||
// if a chroma formatter was not provided, set a default
|
// if a chroma formatter was not provided, set a default
|
||||||
if conf.Formatter == "" {
|
if conf.Formatter == "" {
|
||||||
conf.Formatter = "terminal16m"
|
conf.Formatter = "terminal"
|
||||||
}
|
}
|
||||||
|
|
||||||
// if a pager was not provided, set a default
|
// attempt to fall back to `PAGER` if a pager is not specified in configs
|
||||||
if strings.TrimSpace(conf.Pager) == "" {
|
conf.Pager = strings.TrimSpace(conf.Pager)
|
||||||
conf.Pager = ""
|
if conf.Pager == "" && os.Getenv("PAGER") != "" {
|
||||||
|
conf.Pager = os.Getenv("PAGER")
|
||||||
}
|
}
|
||||||
|
|
||||||
return conf, nil
|
return conf, nil
|
||||||
|
@ -39,17 +39,17 @@ func TestConfigSuccessful(t *testing.T) {
|
|||||||
// assert that the cheatpaths are correct
|
// assert that the cheatpaths are correct
|
||||||
want := []cheatpath.Cheatpath{
|
want := []cheatpath.Cheatpath{
|
||||||
cheatpath.Cheatpath{
|
cheatpath.Cheatpath{
|
||||||
Path: filepath.Join(home, ".dotfiles/cheat/community"),
|
Path: filepath.Join(home, ".dotfiles", "cheat", "community"),
|
||||||
ReadOnly: true,
|
ReadOnly: true,
|
||||||
Tags: []string{"community"},
|
Tags: []string{"community"},
|
||||||
},
|
},
|
||||||
cheatpath.Cheatpath{
|
cheatpath.Cheatpath{
|
||||||
Path: filepath.Join(home, ".dotfiles/cheat/work"),
|
Path: filepath.Join(home, ".dotfiles", "cheat", "work"),
|
||||||
ReadOnly: false,
|
ReadOnly: false,
|
||||||
Tags: []string{"work"},
|
Tags: []string{"work"},
|
||||||
},
|
},
|
||||||
cheatpath.Cheatpath{
|
cheatpath.Cheatpath{
|
||||||
Path: filepath.Join(home, ".dotfiles/cheat/personal"),
|
Path: filepath.Join(home, ".dotfiles", "cheat", "personal"),
|
||||||
ReadOnly: false,
|
ReadOnly: false,
|
||||||
Tags: []string{"personal"},
|
Tags: []string{"personal"},
|
||||||
},
|
},
|
||||||
@ -85,8 +85,8 @@ func TestEmptyEditor(t *testing.T) {
|
|||||||
|
|
||||||
// initialize a config
|
// initialize a config
|
||||||
conf, err := New(map[string]interface{}{}, mock.Path("conf/empty.yml"), false)
|
conf, err := New(map[string]interface{}{}, mock.Path("conf/empty.yml"), false)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
t.Errorf("failed to return an error on empty editor")
|
t.Errorf("failed to initialize test: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// set editor, and assert that it is respected
|
// set editor, and assert that it is respected
|
||||||
|
@ -2,7 +2,7 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/mitchellh/go-homedir"
|
"github.com/mitchellh/go-homedir"
|
||||||
)
|
)
|
||||||
@ -28,25 +28,25 @@ func Paths(
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch sys {
|
switch sys {
|
||||||
case "darwin", "linux", "freebsd":
|
case "android", "darwin", "linux", "freebsd":
|
||||||
paths := []string{}
|
paths := []string{}
|
||||||
|
|
||||||
// don't include the `XDG_CONFIG_HOME` path if that envvar is not set
|
// don't include the `XDG_CONFIG_HOME` path if that envvar is not set
|
||||||
if xdgpath, ok := envvars["XDG_CONFIG_HOME"]; ok {
|
if xdgpath, ok := envvars["XDG_CONFIG_HOME"]; ok {
|
||||||
paths = append(paths, path.Join(xdgpath, "/cheat/conf.yml"))
|
paths = append(paths, filepath.Join(xdgpath, "cheat", "conf.yml"))
|
||||||
}
|
}
|
||||||
|
|
||||||
paths = append(paths, []string{
|
paths = append(paths, []string{
|
||||||
path.Join(home, ".config/cheat/conf.yml"),
|
filepath.Join(home, ".config", "cheat", "conf.yml"),
|
||||||
path.Join(home, ".cheat/conf.yml"),
|
filepath.Join(home, ".cheat", "conf.yml"),
|
||||||
"/etc/cheat/conf.yml",
|
"/etc/cheat/conf.yml",
|
||||||
}...)
|
}...)
|
||||||
|
|
||||||
return paths, nil
|
return paths, nil
|
||||||
case "windows":
|
case "windows":
|
||||||
return []string{
|
return []string{
|
||||||
path.Join(envvars["APPDATA"], "/cheat/conf.yml"),
|
filepath.Join(envvars["APPDATA"], "cheat", "conf.yml"),
|
||||||
path.Join(envvars["PROGRAMDATA"], "/cheat/conf.yml"),
|
filepath.Join(envvars["PROGRAMDATA"], "cheat", "conf.yml"),
|
||||||
}, nil
|
}, nil
|
||||||
default:
|
default:
|
||||||
return []string{}, fmt.Errorf("unsupported os: %s", sys)
|
return []string{}, fmt.Errorf("unsupported os: %s", sys)
|
||||||
|
@ -21,6 +21,7 @@ func TestValidatePathsNix(t *testing.T) {
|
|||||||
|
|
||||||
// specify the platforms to test
|
// specify the platforms to test
|
||||||
oses := []string{
|
oses := []string{
|
||||||
|
"android",
|
||||||
"darwin",
|
"darwin",
|
||||||
"freebsd",
|
"freebsd",
|
||||||
"linux",
|
"linux",
|
||||||
|
@ -23,7 +23,7 @@ func Prompt(prompt string, def bool) (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// normalize the answer
|
// normalize the answer
|
||||||
ans = strings.ToLower(strings.TrimRight(ans, "\n"))
|
ans = strings.ToLower(strings.TrimSpace(ans))
|
||||||
|
|
||||||
// return the appropriate response
|
// return the appropriate response
|
||||||
switch ans {
|
switch ans {
|
||||||
|
@ -3,7 +3,7 @@ package installer
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/cheat/cheat/internal/config"
|
"github.com/cheat/cheat/internal/config"
|
||||||
@ -14,11 +14,11 @@ func Run(configs string, confpath string) error {
|
|||||||
|
|
||||||
// determine the appropriate paths for config data and (optional) community
|
// determine the appropriate paths for config data and (optional) community
|
||||||
// cheatsheets based on the user's platform
|
// cheatsheets based on the user's platform
|
||||||
confdir := path.Dir(confpath)
|
confdir := filepath.Dir(confpath)
|
||||||
|
|
||||||
// create paths for community and personal cheatsheets
|
// create paths for community and personal cheatsheets
|
||||||
community := path.Join(confdir, "/cheatsheets/community")
|
community := filepath.Join(confdir, "cheatsheets", "community")
|
||||||
personal := path.Join(confdir, "/cheatsheets/personal")
|
personal := filepath.Join(confdir, "cheatsheets", "personal")
|
||||||
|
|
||||||
// template the above paths into the default configs
|
// template the above paths into the default configs
|
||||||
configs = strings.Replace(configs, "COMMUNITY_PATH", community, -1)
|
configs = strings.Replace(configs, "COMMUNITY_PATH", community, -1)
|
||||||
@ -36,11 +36,13 @@ func Run(configs string, confpath string) error {
|
|||||||
// clone the community cheatsheets if so instructed
|
// clone the community cheatsheets if so instructed
|
||||||
if yes {
|
if yes {
|
||||||
// clone the community cheatsheets
|
// clone the community cheatsheets
|
||||||
|
fmt.Printf("Cloning community cheatsheets to %s.\n", community)
|
||||||
if err := clone(community); err != nil {
|
if err := clone(community); err != nil {
|
||||||
return fmt.Errorf("failed to clone cheatsheets: %v", err)
|
return fmt.Errorf("failed to clone cheatsheets: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// also create a directory for personal cheatsheets
|
// also create a directory for personal cheatsheets
|
||||||
|
fmt.Printf("Cloning personal cheatsheets to %s.\n", personal)
|
||||||
if err := os.MkdirAll(personal, os.ModePerm); err != nil {
|
if err := os.MkdirAll(personal, os.ModePerm); err != nil {
|
||||||
return fmt.Errorf("failed to create directory: %v", err)
|
return fmt.Errorf("failed to create directory: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Copy copies a cheatsheet to a new location
|
// Copy copies a cheatsheet to a new location
|
||||||
@ -22,7 +22,7 @@ func (s *Sheet) Copy(dest string) error {
|
|||||||
defer infile.Close()
|
defer infile.Close()
|
||||||
|
|
||||||
// create any necessary subdirectories
|
// create any necessary subdirectories
|
||||||
dirs := path.Dir(dest)
|
dirs := filepath.Dir(dest)
|
||||||
if dirs != "." {
|
if dirs != "." {
|
||||||
if err := os.MkdirAll(dirs, 0755); err != nil {
|
if err := os.MkdirAll(dirs, 0755); err != nil {
|
||||||
return fmt.Errorf("failed to create directory: %s, %v", dirs, err)
|
return fmt.Errorf("failed to create directory: %s, %v", dirs, err)
|
||||||
|
14
vendor/github.com/mattn/go-isatty/.travis.yml
generated
vendored
14
vendor/github.com/mattn/go-isatty/.travis.yml
generated
vendored
@ -1,14 +0,0 @@
|
|||||||
language: go
|
|
||||||
sudo: false
|
|
||||||
go:
|
|
||||||
- 1.13.x
|
|
||||||
- tip
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- go get -t -v ./...
|
|
||||||
|
|
||||||
script:
|
|
||||||
- ./go.test.sh
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
|
2
vendor/github.com/mattn/go-isatty/go.mod
generated
vendored
2
vendor/github.com/mattn/go-isatty/go.mod
generated
vendored
@ -2,4 +2,4 @@ module github.com/mattn/go-isatty
|
|||||||
|
|
||||||
go 1.12
|
go 1.12
|
||||||
|
|
||||||
require golang.org/x/sys v0.0.0-20200116001909-b77594299b42
|
require golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
|
||||||
|
1
vendor/github.com/mattn/go-isatty/isatty_bsd.go
generated
vendored
1
vendor/github.com/mattn/go-isatty/isatty_bsd.go
generated
vendored
@ -1,3 +1,4 @@
|
|||||||
|
//go:build (darwin || freebsd || openbsd || netbsd || dragonfly) && !appengine
|
||||||
// +build darwin freebsd openbsd netbsd dragonfly
|
// +build darwin freebsd openbsd netbsd dragonfly
|
||||||
// +build !appengine
|
// +build !appengine
|
||||||
|
|
||||||
|
1
vendor/github.com/mattn/go-isatty/isatty_others.go
generated
vendored
1
vendor/github.com/mattn/go-isatty/isatty_others.go
generated
vendored
@ -1,3 +1,4 @@
|
|||||||
|
//go:build appengine || js || nacl || wasm
|
||||||
// +build appengine js nacl wasm
|
// +build appengine js nacl wasm
|
||||||
|
|
||||||
package isatty
|
package isatty
|
||||||
|
1
vendor/github.com/mattn/go-isatty/isatty_plan9.go
generated
vendored
1
vendor/github.com/mattn/go-isatty/isatty_plan9.go
generated
vendored
@ -1,3 +1,4 @@
|
|||||||
|
//go:build plan9
|
||||||
// +build plan9
|
// +build plan9
|
||||||
|
|
||||||
package isatty
|
package isatty
|
||||||
|
4
vendor/github.com/mattn/go-isatty/isatty_solaris.go
generated
vendored
4
vendor/github.com/mattn/go-isatty/isatty_solaris.go
generated
vendored
@ -1,5 +1,5 @@
|
|||||||
// +build solaris
|
//go:build solaris && !appengine
|
||||||
// +build !appengine
|
// +build solaris,!appengine
|
||||||
|
|
||||||
package isatty
|
package isatty
|
||||||
|
|
||||||
|
1
vendor/github.com/mattn/go-isatty/isatty_tcgets.go
generated
vendored
1
vendor/github.com/mattn/go-isatty/isatty_tcgets.go
generated
vendored
@ -1,3 +1,4 @@
|
|||||||
|
//go:build (linux || aix || zos) && !appengine
|
||||||
// +build linux aix zos
|
// +build linux aix zos
|
||||||
// +build !appengine
|
// +build !appengine
|
||||||
|
|
||||||
|
6
vendor/github.com/mattn/go-isatty/isatty_windows.go
generated
vendored
6
vendor/github.com/mattn/go-isatty/isatty_windows.go
generated
vendored
@ -1,5 +1,5 @@
|
|||||||
// +build windows
|
//go:build windows && !appengine
|
||||||
// +build !appengine
|
// +build windows,!appengine
|
||||||
|
|
||||||
package isatty
|
package isatty
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ func isCygwinPipeName(name string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getFileNameByHandle use the undocomented ntdll NtQueryObject to get file full name from file handler
|
// getFileNameByHandle use the undocomented ntdll NtQueryObject to get file full name from file handler
|
||||||
// since GetFileInformationByHandleEx is not avilable under windows Vista and still some old fashion
|
// since GetFileInformationByHandleEx is not available under windows Vista and still some old fashion
|
||||||
// guys are using Windows XP, this is a workaround for those guys, it will also work on system from
|
// guys are using Windows XP, this is a workaround for those guys, it will also work on system from
|
||||||
// Windows vista to 10
|
// Windows vista to 10
|
||||||
// see https://stackoverflow.com/a/18792477 for details
|
// see https://stackoverflow.com/a/18792477 for details
|
||||||
|
1
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
1
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
@ -563,6 +563,7 @@ ccflags="$@"
|
|||||||
$2 ~ /^KEYCTL_/ ||
|
$2 ~ /^KEYCTL_/ ||
|
||||||
$2 ~ /^PERF_/ ||
|
$2 ~ /^PERF_/ ||
|
||||||
$2 ~ /^SECCOMP_MODE_/ ||
|
$2 ~ /^SECCOMP_MODE_/ ||
|
||||||
|
$2 ~ /^SEEK_/ ||
|
||||||
$2 ~ /^SPLICE_/ ||
|
$2 ~ /^SPLICE_/ ||
|
||||||
$2 ~ /^SYNC_FILE_RANGE_/ ||
|
$2 ~ /^SYNC_FILE_RANGE_/ ||
|
||||||
$2 !~ /^AUDIT_RECORD_MAGIC/ &&
|
$2 !~ /^AUDIT_RECORD_MAGIC/ &&
|
||||||
|
33
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
33
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
@ -13,6 +13,7 @@
|
|||||||
package unix
|
package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
@ -398,6 +399,38 @@ func GetsockoptXucred(fd, level, opt int) (*Xucred, error) {
|
|||||||
return x, err
|
return x, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SysctlKinfoProcSlice(name string) ([]KinfoProc, error) {
|
||||||
|
mib, err := sysctlmib(name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find size.
|
||||||
|
n := uintptr(0)
|
||||||
|
if err := sysctl(mib, nil, &n, nil, 0); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if n == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
if n%SizeofKinfoProc != 0 {
|
||||||
|
return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read into buffer of that size.
|
||||||
|
buf := make([]KinfoProc, n/SizeofKinfoProc)
|
||||||
|
if err := sysctl(mib, (*byte)(unsafe.Pointer(&buf[0])), &n, nil, 0); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if n%SizeofKinfoProc != 0 {
|
||||||
|
return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The actual call may return less than the original reported required
|
||||||
|
// size so ensure we deal with that.
|
||||||
|
return buf[:n/SizeofKinfoProc], nil
|
||||||
|
}
|
||||||
|
|
||||||
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
|
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
generated
vendored
@ -1262,6 +1262,11 @@ const (
|
|||||||
SCM_RIGHTS = 0x1
|
SCM_RIGHTS = 0x1
|
||||||
SCM_TIMESTAMP = 0x2
|
SCM_TIMESTAMP = 0x2
|
||||||
SCM_TIMESTAMP_MONOTONIC = 0x4
|
SCM_TIMESTAMP_MONOTONIC = 0x4
|
||||||
|
SEEK_CUR = 0x1
|
||||||
|
SEEK_DATA = 0x4
|
||||||
|
SEEK_END = 0x2
|
||||||
|
SEEK_HOLE = 0x3
|
||||||
|
SEEK_SET = 0x0
|
||||||
SHUT_RD = 0x0
|
SHUT_RD = 0x0
|
||||||
SHUT_RDWR = 0x2
|
SHUT_RDWR = 0x2
|
||||||
SHUT_WR = 0x1
|
SHUT_WR = 0x1
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go
generated
vendored
@ -1262,6 +1262,11 @@ const (
|
|||||||
SCM_RIGHTS = 0x1
|
SCM_RIGHTS = 0x1
|
||||||
SCM_TIMESTAMP = 0x2
|
SCM_TIMESTAMP = 0x2
|
||||||
SCM_TIMESTAMP_MONOTONIC = 0x4
|
SCM_TIMESTAMP_MONOTONIC = 0x4
|
||||||
|
SEEK_CUR = 0x1
|
||||||
|
SEEK_DATA = 0x4
|
||||||
|
SEEK_END = 0x2
|
||||||
|
SEEK_HOLE = 0x3
|
||||||
|
SEEK_SET = 0x0
|
||||||
SHUT_RD = 0x0
|
SHUT_RD = 0x0
|
||||||
SHUT_RDWR = 0x2
|
SHUT_RDWR = 0x2
|
||||||
SHUT_WR = 0x1
|
SHUT_WR = 0x1
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go
generated
vendored
@ -1297,6 +1297,11 @@ const (
|
|||||||
SCM_RIGHTS = 0x1
|
SCM_RIGHTS = 0x1
|
||||||
SCM_TIMESTAMP = 0x2
|
SCM_TIMESTAMP = 0x2
|
||||||
SCM_TIME_INFO = 0x7
|
SCM_TIME_INFO = 0x7
|
||||||
|
SEEK_CUR = 0x1
|
||||||
|
SEEK_DATA = 0x3
|
||||||
|
SEEK_END = 0x2
|
||||||
|
SEEK_HOLE = 0x4
|
||||||
|
SEEK_SET = 0x0
|
||||||
SHUT_RD = 0x0
|
SHUT_RD = 0x0
|
||||||
SHUT_RDWR = 0x2
|
SHUT_RDWR = 0x2
|
||||||
SHUT_WR = 0x1
|
SHUT_WR = 0x1
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go
generated
vendored
@ -1298,6 +1298,11 @@ const (
|
|||||||
SCM_RIGHTS = 0x1
|
SCM_RIGHTS = 0x1
|
||||||
SCM_TIMESTAMP = 0x2
|
SCM_TIMESTAMP = 0x2
|
||||||
SCM_TIME_INFO = 0x7
|
SCM_TIME_INFO = 0x7
|
||||||
|
SEEK_CUR = 0x1
|
||||||
|
SEEK_DATA = 0x3
|
||||||
|
SEEK_END = 0x2
|
||||||
|
SEEK_HOLE = 0x4
|
||||||
|
SEEK_SET = 0x0
|
||||||
SHUT_RD = 0x0
|
SHUT_RD = 0x0
|
||||||
SHUT_RDWR = 0x2
|
SHUT_RDWR = 0x2
|
||||||
SHUT_WR = 0x1
|
SHUT_WR = 0x1
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go
generated
vendored
@ -1276,6 +1276,11 @@ const (
|
|||||||
SCM_CREDS = 0x3
|
SCM_CREDS = 0x3
|
||||||
SCM_RIGHTS = 0x1
|
SCM_RIGHTS = 0x1
|
||||||
SCM_TIMESTAMP = 0x2
|
SCM_TIMESTAMP = 0x2
|
||||||
|
SEEK_CUR = 0x1
|
||||||
|
SEEK_DATA = 0x3
|
||||||
|
SEEK_END = 0x2
|
||||||
|
SEEK_HOLE = 0x4
|
||||||
|
SEEK_SET = 0x0
|
||||||
SHUT_RD = 0x0
|
SHUT_RD = 0x0
|
||||||
SHUT_RDWR = 0x2
|
SHUT_RDWR = 0x2
|
||||||
SHUT_WR = 0x1
|
SHUT_WR = 0x1
|
||||||
|
5
vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go
generated
vendored
5
vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go
generated
vendored
@ -1298,6 +1298,11 @@ const (
|
|||||||
SCM_RIGHTS = 0x1
|
SCM_RIGHTS = 0x1
|
||||||
SCM_TIMESTAMP = 0x2
|
SCM_TIMESTAMP = 0x2
|
||||||
SCM_TIME_INFO = 0x7
|
SCM_TIME_INFO = 0x7
|
||||||
|
SEEK_CUR = 0x1
|
||||||
|
SEEK_DATA = 0x3
|
||||||
|
SEEK_END = 0x2
|
||||||
|
SEEK_HOLE = 0x4
|
||||||
|
SEEK_SET = 0x0
|
||||||
SHUT_RD = 0x0
|
SHUT_RD = 0x0
|
||||||
SHUT_RDWR = 0x2
|
SHUT_RDWR = 0x2
|
||||||
SHUT_WR = 0x1
|
SHUT_WR = 0x1
|
||||||
|
6
vendor/golang.org/x/sys/unix/zerrors_linux.go
generated
vendored
6
vendor/golang.org/x/sys/unix/zerrors_linux.go
generated
vendored
@ -2284,6 +2284,12 @@ const (
|
|||||||
SECCOMP_MODE_FILTER = 0x2
|
SECCOMP_MODE_FILTER = 0x2
|
||||||
SECCOMP_MODE_STRICT = 0x1
|
SECCOMP_MODE_STRICT = 0x1
|
||||||
SECURITYFS_MAGIC = 0x73636673
|
SECURITYFS_MAGIC = 0x73636673
|
||||||
|
SEEK_CUR = 0x1
|
||||||
|
SEEK_DATA = 0x3
|
||||||
|
SEEK_END = 0x2
|
||||||
|
SEEK_HOLE = 0x4
|
||||||
|
SEEK_MAX = 0x4
|
||||||
|
SEEK_SET = 0x0
|
||||||
SELINUX_MAGIC = 0xf97cff8c
|
SELINUX_MAGIC = 0xf97cff8c
|
||||||
SHUT_RD = 0x0
|
SHUT_RD = 0x0
|
||||||
SHUT_RDWR = 0x2
|
SHUT_RDWR = 0x2
|
||||||
|
104
vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
generated
vendored
104
vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
generated
vendored
@ -535,3 +535,107 @@ type CtlInfo struct {
|
|||||||
Id uint32
|
Id uint32
|
||||||
Name [96]byte
|
Name [96]byte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SizeofKinfoProc = 0x288
|
||||||
|
|
||||||
|
type Eproc struct {
|
||||||
|
Paddr uintptr
|
||||||
|
Sess uintptr
|
||||||
|
Pcred Pcred
|
||||||
|
Ucred Ucred
|
||||||
|
Vm Vmspace
|
||||||
|
Ppid int32
|
||||||
|
Pgid int32
|
||||||
|
Jobc int16
|
||||||
|
Tdev int32
|
||||||
|
Tpgid int32
|
||||||
|
Tsess uintptr
|
||||||
|
Wmesg [8]int8
|
||||||
|
Xsize int32
|
||||||
|
Xrssize int16
|
||||||
|
Xccount int16
|
||||||
|
Xswrss int16
|
||||||
|
Flag int32
|
||||||
|
Login [12]int8
|
||||||
|
Spare [4]int32
|
||||||
|
_ [4]byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type ExternProc struct {
|
||||||
|
P_starttime Timeval
|
||||||
|
P_vmspace *Vmspace
|
||||||
|
P_sigacts uintptr
|
||||||
|
P_flag int32
|
||||||
|
P_stat int8
|
||||||
|
P_pid int32
|
||||||
|
P_oppid int32
|
||||||
|
P_dupfd int32
|
||||||
|
User_stack *int8
|
||||||
|
Exit_thread *byte
|
||||||
|
P_debugger int32
|
||||||
|
Sigwait int32
|
||||||
|
P_estcpu uint32
|
||||||
|
P_cpticks int32
|
||||||
|
P_pctcpu uint32
|
||||||
|
P_wchan *byte
|
||||||
|
P_wmesg *int8
|
||||||
|
P_swtime uint32
|
||||||
|
P_slptime uint32
|
||||||
|
P_realtimer Itimerval
|
||||||
|
P_rtime Timeval
|
||||||
|
P_uticks uint64
|
||||||
|
P_sticks uint64
|
||||||
|
P_iticks uint64
|
||||||
|
P_traceflag int32
|
||||||
|
P_tracep uintptr
|
||||||
|
P_siglist int32
|
||||||
|
P_textvp uintptr
|
||||||
|
P_holdcnt int32
|
||||||
|
P_sigmask uint32
|
||||||
|
P_sigignore uint32
|
||||||
|
P_sigcatch uint32
|
||||||
|
P_priority uint8
|
||||||
|
P_usrpri uint8
|
||||||
|
P_nice int8
|
||||||
|
P_comm [17]int8
|
||||||
|
P_pgrp uintptr
|
||||||
|
P_addr uintptr
|
||||||
|
P_xstat uint16
|
||||||
|
P_acflag uint16
|
||||||
|
P_ru *Rusage
|
||||||
|
}
|
||||||
|
|
||||||
|
type Itimerval struct {
|
||||||
|
Interval Timeval
|
||||||
|
Value Timeval
|
||||||
|
}
|
||||||
|
|
||||||
|
type KinfoProc struct {
|
||||||
|
Proc ExternProc
|
||||||
|
Eproc Eproc
|
||||||
|
}
|
||||||
|
|
||||||
|
type Vmspace struct {
|
||||||
|
Dummy int32
|
||||||
|
Dummy2 *int8
|
||||||
|
Dummy3 [5]int32
|
||||||
|
Dummy4 [3]*int8
|
||||||
|
}
|
||||||
|
|
||||||
|
type Pcred struct {
|
||||||
|
Pc_lock [72]int8
|
||||||
|
Pc_ucred uintptr
|
||||||
|
P_ruid uint32
|
||||||
|
P_svuid uint32
|
||||||
|
P_rgid uint32
|
||||||
|
P_svgid uint32
|
||||||
|
P_refcnt int32
|
||||||
|
_ [4]byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type Ucred struct {
|
||||||
|
Ref int32
|
||||||
|
Uid uint32
|
||||||
|
Ngroups int16
|
||||||
|
Groups [16]uint32
|
||||||
|
}
|
||||||
|
104
vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
generated
vendored
104
vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
generated
vendored
@ -535,3 +535,107 @@ type CtlInfo struct {
|
|||||||
Id uint32
|
Id uint32
|
||||||
Name [96]byte
|
Name [96]byte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SizeofKinfoProc = 0x288
|
||||||
|
|
||||||
|
type Eproc struct {
|
||||||
|
Paddr uintptr
|
||||||
|
Sess uintptr
|
||||||
|
Pcred Pcred
|
||||||
|
Ucred Ucred
|
||||||
|
Vm Vmspace
|
||||||
|
Ppid int32
|
||||||
|
Pgid int32
|
||||||
|
Jobc int16
|
||||||
|
Tdev int32
|
||||||
|
Tpgid int32
|
||||||
|
Tsess uintptr
|
||||||
|
Wmesg [8]int8
|
||||||
|
Xsize int32
|
||||||
|
Xrssize int16
|
||||||
|
Xccount int16
|
||||||
|
Xswrss int16
|
||||||
|
Flag int32
|
||||||
|
Login [12]int8
|
||||||
|
Spare [4]int32
|
||||||
|
_ [4]byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type ExternProc struct {
|
||||||
|
P_starttime Timeval
|
||||||
|
P_vmspace *Vmspace
|
||||||
|
P_sigacts uintptr
|
||||||
|
P_flag int32
|
||||||
|
P_stat int8
|
||||||
|
P_pid int32
|
||||||
|
P_oppid int32
|
||||||
|
P_dupfd int32
|
||||||
|
User_stack *int8
|
||||||
|
Exit_thread *byte
|
||||||
|
P_debugger int32
|
||||||
|
Sigwait int32
|
||||||
|
P_estcpu uint32
|
||||||
|
P_cpticks int32
|
||||||
|
P_pctcpu uint32
|
||||||
|
P_wchan *byte
|
||||||
|
P_wmesg *int8
|
||||||
|
P_swtime uint32
|
||||||
|
P_slptime uint32
|
||||||
|
P_realtimer Itimerval
|
||||||
|
P_rtime Timeval
|
||||||
|
P_uticks uint64
|
||||||
|
P_sticks uint64
|
||||||
|
P_iticks uint64
|
||||||
|
P_traceflag int32
|
||||||
|
P_tracep uintptr
|
||||||
|
P_siglist int32
|
||||||
|
P_textvp uintptr
|
||||||
|
P_holdcnt int32
|
||||||
|
P_sigmask uint32
|
||||||
|
P_sigignore uint32
|
||||||
|
P_sigcatch uint32
|
||||||
|
P_priority uint8
|
||||||
|
P_usrpri uint8
|
||||||
|
P_nice int8
|
||||||
|
P_comm [17]int8
|
||||||
|
P_pgrp uintptr
|
||||||
|
P_addr uintptr
|
||||||
|
P_xstat uint16
|
||||||
|
P_acflag uint16
|
||||||
|
P_ru *Rusage
|
||||||
|
}
|
||||||
|
|
||||||
|
type Itimerval struct {
|
||||||
|
Interval Timeval
|
||||||
|
Value Timeval
|
||||||
|
}
|
||||||
|
|
||||||
|
type KinfoProc struct {
|
||||||
|
Proc ExternProc
|
||||||
|
Eproc Eproc
|
||||||
|
}
|
||||||
|
|
||||||
|
type Vmspace struct {
|
||||||
|
Dummy int32
|
||||||
|
Dummy2 *int8
|
||||||
|
Dummy3 [5]int32
|
||||||
|
Dummy4 [3]*int8
|
||||||
|
}
|
||||||
|
|
||||||
|
type Pcred struct {
|
||||||
|
Pc_lock [72]int8
|
||||||
|
Pc_ucred uintptr
|
||||||
|
P_ruid uint32
|
||||||
|
P_svuid uint32
|
||||||
|
P_rgid uint32
|
||||||
|
P_svgid uint32
|
||||||
|
P_refcnt int32
|
||||||
|
_ [4]byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type Ucred struct {
|
||||||
|
Ref int32
|
||||||
|
Uid uint32
|
||||||
|
Ngroups int16
|
||||||
|
Groups [16]uint32
|
||||||
|
}
|
||||||
|
3
vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go
generated
vendored
3
vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go
generated
vendored
@ -431,6 +431,9 @@ type Winsize struct {
|
|||||||
const (
|
const (
|
||||||
AT_FDCWD = 0xfffafdcd
|
AT_FDCWD = 0xfffafdcd
|
||||||
AT_SYMLINK_NOFOLLOW = 0x1
|
AT_SYMLINK_NOFOLLOW = 0x1
|
||||||
|
AT_REMOVEDIR = 0x2
|
||||||
|
AT_EACCESS = 0x4
|
||||||
|
AT_SYMLINK_FOLLOW = 0x8
|
||||||
)
|
)
|
||||||
|
|
||||||
type PollFd struct {
|
type PollFd struct {
|
||||||
|
5
vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go
generated
vendored
5
vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go
generated
vendored
@ -672,9 +672,10 @@ type Winsize struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AT_FDCWD = -0x64
|
AT_FDCWD = -0x64
|
||||||
AT_REMOVEDIR = 0x800
|
AT_EACCESS = 0x100
|
||||||
AT_SYMLINK_FOLLOW = 0x400
|
|
||||||
AT_SYMLINK_NOFOLLOW = 0x200
|
AT_SYMLINK_NOFOLLOW = 0x200
|
||||||
|
AT_SYMLINK_FOLLOW = 0x400
|
||||||
|
AT_REMOVEDIR = 0x800
|
||||||
)
|
)
|
||||||
|
|
||||||
type PollFd struct {
|
type PollFd struct {
|
||||||
|
5
vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go
generated
vendored
5
vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go
generated
vendored
@ -675,9 +675,10 @@ type Winsize struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AT_FDCWD = -0x64
|
AT_FDCWD = -0x64
|
||||||
AT_REMOVEDIR = 0x800
|
AT_EACCESS = 0x100
|
||||||
AT_SYMLINK_FOLLOW = 0x400
|
|
||||||
AT_SYMLINK_NOFOLLOW = 0x200
|
AT_SYMLINK_NOFOLLOW = 0x200
|
||||||
|
AT_SYMLINK_FOLLOW = 0x400
|
||||||
|
AT_REMOVEDIR = 0x800
|
||||||
)
|
)
|
||||||
|
|
||||||
type PollFd struct {
|
type PollFd struct {
|
||||||
|
5
vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go
generated
vendored
5
vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go
generated
vendored
@ -656,9 +656,10 @@ type Winsize struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AT_FDCWD = -0x64
|
AT_FDCWD = -0x64
|
||||||
AT_REMOVEDIR = 0x800
|
AT_EACCESS = 0x100
|
||||||
AT_SYMLINK_FOLLOW = 0x400
|
|
||||||
AT_SYMLINK_NOFOLLOW = 0x200
|
AT_SYMLINK_NOFOLLOW = 0x200
|
||||||
|
AT_SYMLINK_FOLLOW = 0x400
|
||||||
|
AT_REMOVEDIR = 0x800
|
||||||
)
|
)
|
||||||
|
|
||||||
type PollFd struct {
|
type PollFd struct {
|
||||||
|
5
vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go
generated
vendored
5
vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go
generated
vendored
@ -653,9 +653,10 @@ type Winsize struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AT_FDCWD = -0x64
|
AT_FDCWD = -0x64
|
||||||
AT_REMOVEDIR = 0x800
|
AT_EACCESS = 0x100
|
||||||
AT_SYMLINK_FOLLOW = 0x400
|
|
||||||
AT_SYMLINK_NOFOLLOW = 0x200
|
AT_SYMLINK_NOFOLLOW = 0x200
|
||||||
|
AT_SYMLINK_FOLLOW = 0x400
|
||||||
|
AT_REMOVEDIR = 0x800
|
||||||
)
|
)
|
||||||
|
|
||||||
type PollFd struct {
|
type PollFd struct {
|
||||||
|
2
vendor/golang.org/x/sys/unix/ztypes_linux.go
generated
vendored
2
vendor/golang.org/x/sys/unix/ztypes_linux.go
generated
vendored
@ -1773,6 +1773,8 @@ const (
|
|||||||
NFPROTO_NUMPROTO = 0xd
|
NFPROTO_NUMPROTO = 0xd
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const SO_ORIGINAL_DST = 0x50
|
||||||
|
|
||||||
type Nfgenmsg struct {
|
type Nfgenmsg struct {
|
||||||
Nfgen_family uint8
|
Nfgen_family uint8
|
||||||
Version uint8
|
Version uint8
|
||||||
|
4
vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go
generated
vendored
4
vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go
generated
vendored
@ -445,8 +445,10 @@ type Ptmget struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AT_FDCWD = -0x64
|
AT_FDCWD = -0x64
|
||||||
AT_SYMLINK_FOLLOW = 0x400
|
AT_EACCESS = 0x100
|
||||||
AT_SYMLINK_NOFOLLOW = 0x200
|
AT_SYMLINK_NOFOLLOW = 0x200
|
||||||
|
AT_SYMLINK_FOLLOW = 0x400
|
||||||
|
AT_REMOVEDIR = 0x800
|
||||||
)
|
)
|
||||||
|
|
||||||
type PollFd struct {
|
type PollFd struct {
|
||||||
|
4
vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go
generated
vendored
4
vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go
generated
vendored
@ -453,8 +453,10 @@ type Ptmget struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AT_FDCWD = -0x64
|
AT_FDCWD = -0x64
|
||||||
AT_SYMLINK_FOLLOW = 0x400
|
AT_EACCESS = 0x100
|
||||||
AT_SYMLINK_NOFOLLOW = 0x200
|
AT_SYMLINK_NOFOLLOW = 0x200
|
||||||
|
AT_SYMLINK_FOLLOW = 0x400
|
||||||
|
AT_REMOVEDIR = 0x800
|
||||||
)
|
)
|
||||||
|
|
||||||
type PollFd struct {
|
type PollFd struct {
|
||||||
|
4
vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go
generated
vendored
4
vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go
generated
vendored
@ -450,8 +450,10 @@ type Ptmget struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AT_FDCWD = -0x64
|
AT_FDCWD = -0x64
|
||||||
AT_SYMLINK_FOLLOW = 0x400
|
AT_EACCESS = 0x100
|
||||||
AT_SYMLINK_NOFOLLOW = 0x200
|
AT_SYMLINK_NOFOLLOW = 0x200
|
||||||
|
AT_SYMLINK_FOLLOW = 0x400
|
||||||
|
AT_REMOVEDIR = 0x800
|
||||||
)
|
)
|
||||||
|
|
||||||
type PollFd struct {
|
type PollFd struct {
|
||||||
|
4
vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go
generated
vendored
4
vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go
generated
vendored
@ -453,8 +453,10 @@ type Ptmget struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AT_FDCWD = -0x64
|
AT_FDCWD = -0x64
|
||||||
AT_SYMLINK_FOLLOW = 0x400
|
AT_EACCESS = 0x100
|
||||||
AT_SYMLINK_NOFOLLOW = 0x200
|
AT_SYMLINK_NOFOLLOW = 0x200
|
||||||
|
AT_SYMLINK_FOLLOW = 0x400
|
||||||
|
AT_REMOVEDIR = 0x800
|
||||||
)
|
)
|
||||||
|
|
||||||
type PollFd struct {
|
type PollFd struct {
|
||||||
|
5
vendor/modules.txt
vendored
5
vendor/modules.txt
vendored
@ -47,7 +47,7 @@ github.com/dlclark/regexp2/syntax
|
|||||||
github.com/docopt/docopt-go
|
github.com/docopt/docopt-go
|
||||||
# github.com/kr/text v0.2.0
|
# github.com/kr/text v0.2.0
|
||||||
## explicit
|
## explicit
|
||||||
# github.com/mattn/go-isatty v0.0.13
|
# github.com/mattn/go-isatty v0.0.14
|
||||||
## explicit
|
## explicit
|
||||||
github.com/mattn/go-isatty
|
github.com/mattn/go-isatty
|
||||||
# github.com/mitchellh/go-homedir v1.1.0
|
# github.com/mitchellh/go-homedir v1.1.0
|
||||||
@ -57,8 +57,7 @@ github.com/mitchellh/go-homedir
|
|||||||
## explicit
|
## explicit
|
||||||
# github.com/sergi/go-diff v1.1.0
|
# github.com/sergi/go-diff v1.1.0
|
||||||
## explicit
|
## explicit
|
||||||
# golang.org/x/sys v0.0.0-20210608053332-aa57babbf139
|
# golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
|
||||||
## explicit
|
|
||||||
golang.org/x/sys/internal/unsafeheader
|
golang.org/x/sys/internal/unsafeheader
|
||||||
golang.org/x/sys/unix
|
golang.org/x/sys/unix
|
||||||
# gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f
|
# gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f
|
||||||
|
Reference in New Issue
Block a user