Merge branch 'go1.16'
This commit is contained in:
commit
162ed50189
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -13,3 +13,4 @@ build/gotop_*
|
||||||
build.log
|
build.log
|
||||||
|
|
||||||
tmp/
|
tmp/
|
||||||
|
dist/
|
||||||
|
|
20
CHANGELOG.md
20
CHANGELOG.md
|
@ -13,6 +13,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
> - **Fixed**: for any bug fixes.
|
> - **Fixed**: for any bug fixes.
|
||||||
> - **Security**: in case of vulnerabilities.
|
> - **Security**: in case of vulnerabilities.
|
||||||
|
|
||||||
|
## [4.1.2]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- French and Russion translations (thank you @lourkeur and @talentlessguy!)
|
||||||
|
- nvidia support merged in from extension
|
||||||
|
- remote support merged in from extension
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Upgrade to Go 1.16. This eliminates go:generate for the language files, which
|
||||||
|
means gotop no longer builds with Go < 1.16.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- German translation corrected (thanks @plgruener!)
|
||||||
|
- Extra spaces in help text (#167)
|
||||||
|
- Crash with German translation (#166)
|
||||||
|
- Bad error message for missing layouts (#164)
|
||||||
|
|
||||||
## [4.1.1] 2021-02-03
|
## [4.1.1] 2021-02-03
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
29
README.md
29
README.md
|
@ -35,13 +35,16 @@ If you install gotop by hand, or you download or create new layouts or colorsche
|
||||||
```
|
```
|
||||||
- **OSX**: gotop is in *homebrew-core*. `brew install gotop`. Make sure to uninstall and untap any previous installations or taps.
|
- **OSX**: gotop is in *homebrew-core*. `brew install gotop`. Make sure to uninstall and untap any previous installations or taps.
|
||||||
- **Prebuilt binaries**: Binaries for most systems can be downloaded from [the github releases page](https://github.com/xxxserxxx/gotop/releases). RPM and DEB packages are also provided.
|
- **Prebuilt binaries**: Binaries for most systems can be downloaded from [the github releases page](https://github.com/xxxserxxx/gotop/releases). RPM and DEB packages are also provided.
|
||||||
- **Source**: gotop requires Go >= 1.14: `go get -u github.com/xxxserxxx/gotop/v4/cmd/gotop`
|
- **Prebuild binaries with extensions**:
|
||||||
|
- [NVidia GPU support](https://github.com/xxxserxxx/gotop-nvidia/releases)
|
||||||
|
- [Remote gotop support](https://github.com/xxxserxxx/gotop-remote/releases)
|
||||||
|
- **Source**: This requires Go >= 1.16. `go get -u github.com/xxxserxxx/gotop/v4/cmd/gotop`
|
||||||
|
|
||||||
### Extension builds
|
### Extension builds
|
||||||
|
|
||||||
Extensions have proven problematic; go plugins are not usable in real-world cases, and the solution I had running for a while was hacky, at best. Consequently, extensions have been moved into the main code base for now.
|
Extensions have proven problematic; go plugins are not usable in real-world cases, and the solution I had running for a while was hacky, at best. Consequently, extensions have been moved into the main code base for now.
|
||||||
|
|
||||||
- nvidia support: requires the `enable` flag. Detecting nvidia hardware, or rather, the absense of NVidia hardware, can take seconds; this greatly slows down gotop's start-up time. To avoid this, the NVidia code will not be run unless it has been enabled with the `--enable nvidia` runtime flag.
|
- nvidia support: use the `--nvidia` flag to enable. You must have the `nvidia- smi` package installed, and gotop must be able to find the `nvidia-smi` executable, for this to work.
|
||||||
- remote: allows gotop to pull sensor data from applications exporting Prometheus metrics, including remote gotop instances themselves.
|
- remote: allows gotop to pull sensor data from applications exporting Prometheus metrics, including remote gotop instances themselves.
|
||||||
|
|
||||||
### Console Users
|
### Console Users
|
||||||
|
@ -57,12 +60,12 @@ setfont Lat15-VGA16-braille.psf
|
||||||
|
|
||||||
This is the download & compile approach.
|
This is the download & compile approach.
|
||||||
|
|
||||||
gotop should build with most versions of Go. If you have a version other than 1.14 installed, remove the `go` line at the end of `go.mod` and it should work.
|
gotop requires Go 1.16 or later to build, as it relies on the embed feature released with 1.16; a library it uses, lingo, uses both embed and the `io/fs` package. For a version of gotop that builds with earlier versions, check out one of the tags prior to v4.2.0.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git clone https://github.com/xxxserxxx/gotop.git
|
git clone https://github.com/xxxserxxx/gotop.git
|
||||||
cd gotop
|
cd gotop
|
||||||
sed -i '/^go/d' go.mod # Do this if you have go != 1.14
|
# This ugly SOB gets a usable version from the git tag list
|
||||||
VERS="$(git tag -l --sort=-v:refname | sed 's/v\([^-].*\)/\1/g' | head -1 | tr -d '-' ).$(git describe --long --tags | sed 's/\([^-].*\)-\([0-9]*\)-\(g.*\)/r\2.\3/g' | tr -d '-')"
|
VERS="$(git tag -l --sort=-v:refname | sed 's/v\([^-].*\)/\1/g' | head -1 | tr -d '-' ).$(git describe --long --tags | sed 's/\([^-].*\)-\([0-9]*\)-\(g.*\)/r\2.\3/g' | tr -d '-')"
|
||||||
DAT=$(date +%Y%m%dT%H%M%S)
|
DAT=$(date +%Y%m%dT%H%M%S)
|
||||||
go build -o gotop \
|
go build -o gotop \
|
||||||
|
@ -70,13 +73,19 @@ go build -o gotop \
|
||||||
./cmd/gotop
|
./cmd/gotop
|
||||||
```
|
```
|
||||||
|
|
||||||
Move `gotop` to somewhere in your `$PATH`.
|
If you want to compact the executable as much as possible on Linux, change the `ldflags` line to this:
|
||||||
|
|
||||||
|
```
|
||||||
|
-ldflags "-X main.Version=v${VERS} -X main.BuildDate=${DAT} -extldflags '-s -w'" \
|
||||||
|
```
|
||||||
|
|
||||||
|
Now move the `gotop` executable to somewhere in your `$PATH`.
|
||||||
|
|
||||||
If Go is not installed or is the wrong version, and you don't have root access or don't want to upgrade Go, a script is provided to download Go and the gotop sources, compile gotop, and then clean up. See `scripts/install_without_root.sh`.
|
If Go is not installed or is the wrong version, and you don't have root access or don't want to upgrade Go, a script is provided to download Go and the gotop sources, compile gotop, and then clean up. See `scripts/install_without_root.sh`.
|
||||||
|
|
||||||
#### go generate
|
#### go generate
|
||||||
|
|
||||||
Apple SMC tags are embedded in a text file that is compiled into the executable; the same happens with the language translations. When the file `devices/data/sm.tsv` or any translations in `translations/dicts/` change, `go generate` should be re-run.
|
With Go 1.16, it is no longer necessary to call `go generate`. Translations and Apple SMC tags are emded with `go:embed`.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@ -119,7 +128,8 @@ For more information on other topics, see:
|
||||||
- [goreleaser/nfpm](https://github.com/goreleaser/nfpm)
|
- [goreleaser/nfpm](https://github.com/goreleaser/nfpm)
|
||||||
- [distatus/battery](https://github.com/distatus/battery)
|
- [distatus/battery](https://github.com/distatus/battery)
|
||||||
- [VictoriaMetrics/metrics](https://github.com/VictoriaMetrics/metrics) Check this out! The API is clean, elegant, introduces many fewer indirect dependencies than the Prometheus client, and adds 50% less size to binaries.
|
- [VictoriaMetrics/metrics](https://github.com/VictoriaMetrics/metrics) Check this out! The API is clean, elegant, introduces many fewer indirect dependencies than the Prometheus client, and adds 50% less size to binaries.
|
||||||
- [lingo-toml](https://github.com/jdkeke142/lingo-toml) provides the translation support library.
|
- [lingo](https://github.com/xxxserxxx/lingo) is forked from [jdkeke142's](https://github.com/jdkeke142/lingo-toml) lingo, which was in turn forked from [kortemy's](https://github.com/kortemy/lingo) original project.
|
||||||
|
|
||||||
|
|
||||||
## History
|
## History
|
||||||
|
|
||||||
|
@ -130,12 +140,13 @@ For more information on other topics, see:
|
||||||
I obviously think gotop is the Bee's Knees, but there are many alternatives. Many of these have been around for years. All of them are terminal-based tools.
|
I obviously think gotop is the Bee's Knees, but there are many alternatives. Many of these have been around for years. All of them are terminal-based tools.
|
||||||
|
|
||||||
- Grandpa [top](http://sourceforge.net/projects/unixtop/). Written 36 years ago, C, installed by default on almost every Unix descendant.
|
- Grandpa [top](http://sourceforge.net/projects/unixtop/). Written 36 years ago, C, installed by default on almost every Unix descendant.
|
||||||
|
- [bashtop](https://github.com/aristocratos/bashtop), in pure bash! Beautiful and space efficient, and [deserves special comment](docs/bashtop.md).
|
||||||
|
- [bpytop](https://github.com/aristocratos/bpytop), aristocratos, the author of bashtop, rewrote it in Python in mid-2020; it's the same beautiful interface, and a very nice alternative.
|
||||||
- [htop](https://hisham.hm/htop/). A prettier top. Similar functionality. 16 years old!
|
- [htop](https://hisham.hm/htop/). A prettier top. Similar functionality. 16 years old!
|
||||||
- [atop](https://www.atoptool.nl/). Detailed process-focused inspection with a table-like view. Been around for 9 long years.
|
- [atop](https://www.atoptool.nl/). Detailed process-focused inspection with a table-like view. Been around for 9 long years.
|
||||||
- [iftop](http://www.ex-parrot.com/~pdw/iftop/), a top for network connections. More than just data transfer, iftop will show what interfaces are connecting to what IP addresses. Requires root access to run.
|
- [iftop](http://www.ex-parrot.com/~pdw/iftop/), a top for network connections. More than just data transfer, iftop will show what interfaces are connecting to what IP addresses. Requires root access to run.
|
||||||
- [iotop](http://guichaz.free.fr/iotop/), top for disk access. Tells you *which* processes are writing to and from disk space, and how much. Also requires root access to run.
|
- [iotop](http://guichaz.free.fr/iotop/), top for disk access. Tells you *which* processes are writing to and from disk space, and how much. Also requires root access to run.
|
||||||
- [nmon](http://nmon.sourceforge.net) a dashboard style top; widgets can be dynamically enabled and disabled, pure ASCII rendering, so it doesn't rely on fancy character sets to draw bars.
|
- [nmon](http://nmon.sourceforge.net) a dashboard style top; widgets can be dynamically enabled and disabled, pure ASCII rendering, so it doesn't rely on fancy character sets to draw bars.
|
||||||
- [bashtop](https://github.com/aristocratos/bashtop), in pure bash! Beautiful and space efficient, and [deserves special comment](docs/bashtop.md). If you use anything other than gotop, I'd recommend bashtop.
|
|
||||||
- [ytop](https://github.com/cjbassi/ytop), a rewrite of gotop (ca. 3.0) in Rust. Same great UI, different programming language.
|
- [ytop](https://github.com/cjbassi/ytop), a rewrite of gotop (ca. 3.0) in Rust. Same great UI, different programming language.
|
||||||
- [slabtop](https://gitlab.com/procps-ng/procps), part of procps-ng, looks like top but provides kernel slab cache information! Requires root.
|
- [slabtop](https://gitlab.com/procps-ng/procps), part of procps-ng, looks like top but provides kernel slab cache information! Requires root.
|
||||||
- [systemd-cgtop](https://www.github.com/systemd/systemd), comes with systemd (odds are your system uses systemd, so this is already installed), provides a resource use view of control groups -- basically, which services are using what resources. Does *not* require root to run.
|
- [systemd-cgtop](https://www.github.com/systemd/systemd), comes with systemd (odds are your system uses systemd, so this is already installed), provides a resource use view of control groups -- basically, which services are using what resources. Does *not* require root to run.
|
||||||
|
@ -145,7 +156,7 @@ I obviously think gotop is the Bee's Knees, but there are many alternatives. Man
|
||||||
|
|
||||||
### A comment on clones
|
### A comment on clones
|
||||||
|
|
||||||
In a chat room I heard someone refer to gotop as "another one of those fancy language rewrites people do." I'm not the original author of gotop, so it's easy to not take offense, but I'm going on record as saying that I disagree with that sentiment: I think these rewrites are valuable, useful, and healthy to the community. They increase software diversity at very little [cost to users](https://en.wikipedia.org/wiki/Information_overload), and are a sort of evolutionary mechanism: as people do rewrites, some are worse, but some are better, and users benefit. Rewrites provide options, which fight against [monocultures](https://github.com). As importantly, most developers are really only fluent in a couple of programming languages. We all have *familiarity* with a dozen, and may even have extensive experience with a half-dozen, but if you don't constantly use a language, you tend to forget the extended library APIs, your development environment isn't tuned, you're rusty with using the tool sets, and you may have forgotten a lot of the language peculiarities and gotchas. The barrier to entry for contributing to a software project -- to simply finding and fixing a bug -- in a language you're not intimate with can be very high. It gets much worse if the project owner is a stickler for quality and style. So I believe that gotop's original author's decision to rewrite his project in Rust is a net positive. He probably made fewer design mistakes in ytop (we always do, on the second rewrite), and Rust developers -- who may have hesitated learning or brushing up on Go to submit an improvement -- have another project to which they can contribute.
|
In a chat room I heard someone refer to gotop as "another one of those fancy language rewrites people do." I'm not the original author of gotop, so it's easy to not take offense, but I'm going on record as saying that I disagree with that sentiment: I think these rewrites are valuable, useful, and healthy to the community. They increase software diversity at very little [cost to users](https://en.wikipedia.org/wiki/Information_overload), and are a sort of evolutionary mechanism: as people do rewrites, some are worse, but some are better, and users benefit. Rewrites provide options, which fight against [monocultures](https://github.com). As importantly, most developers are really only fluent in a couple of programming languages. We all have *familiarity* with a dozen, and may even have extensive experience with a half-dozen, but if you don't constantly use a language, you tend to forget the extended library APIs, your development environment isn't tuned, you're rusty with using the tool sets, and you may have forgotten a lot of the language peculiarities and gotchas. The barrier to entry for contributing to a software project -- to simply finding and fixing a bug -- in a language you're not intimate with can be very high. It gets much worse if the project owner is a stickler for a particular style. So I believe that gotop's original author's decision to rewrite his project in Rust is a net positive. He probably made fewer design mistakes in ytop (we always do, on the second rewrite), and Rust developers -- who may have hesitated learning or brushing up on Go to submit an improvement -- have another project to which they can contribute.
|
||||||
|
|
||||||
Diversity is good. Don't knock the free stuff.
|
Diversity is good. Don't knock the free stuff.
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"io/fs"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -22,7 +23,7 @@ import (
|
||||||
jj "github.com/cloudfoundry-attic/jibber_jabber"
|
jj "github.com/cloudfoundry-attic/jibber_jabber"
|
||||||
ui "github.com/gizak/termui/v3"
|
ui "github.com/gizak/termui/v3"
|
||||||
"github.com/shibukawa/configdir"
|
"github.com/shibukawa/configdir"
|
||||||
"github.com/xxxserxxx/lingo"
|
"github.com/xxxserxxx/lingo/v2"
|
||||||
"github.com/xxxserxxx/opflag"
|
"github.com/xxxserxxx/opflag"
|
||||||
|
|
||||||
"github.com/xxxserxxx/gotop/v4"
|
"github.com/xxxserxxx/gotop/v4"
|
||||||
|
@ -30,7 +31,6 @@ import (
|
||||||
"github.com/xxxserxxx/gotop/v4/devices"
|
"github.com/xxxserxxx/gotop/v4/devices"
|
||||||
"github.com/xxxserxxx/gotop/v4/layout"
|
"github.com/xxxserxxx/gotop/v4/layout"
|
||||||
"github.com/xxxserxxx/gotop/v4/logging"
|
"github.com/xxxserxxx/gotop/v4/logging"
|
||||||
"github.com/xxxserxxx/gotop/v4/translations"
|
|
||||||
w "github.com/xxxserxxx/gotop/v4/widgets"
|
w "github.com/xxxserxxx/gotop/v4/widgets"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -126,14 +126,22 @@ func parseArgs() error {
|
||||||
case "widgets":
|
case "widgets":
|
||||||
fmt.Println(tr.Value("help.widgets"))
|
fmt.Println(tr.Value("help.widgets"))
|
||||||
case "langs":
|
case "langs":
|
||||||
vs, err := translations.AssetDir("")
|
err := fs.WalkDir(gotop.Dicts, ".", func(pth string, info fs.DirEntry, err error) error {
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if info.IsDir() { // We skip these
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
fileName := info.Name()
|
||||||
|
if !strings.HasSuffix(fileName, ".toml") {
|
||||||
|
fmt.Println(strings.TrimSuffix(fileName, ".toml"))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, v := range vs {
|
|
||||||
v = strings.TrimSuffix(v, ".toml")
|
|
||||||
fmt.Println(v)
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
fmt.Printf(tr.Value("error.unknownopt", *list))
|
fmt.Printf(tr.Value("error.unknownopt", *list))
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -366,7 +374,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func run() int {
|
func run() int {
|
||||||
ling, err := lingo.New("en_US", "", translations.AssetFile())
|
ling, err := lingo.New("en_US", ".", gotop.Dicts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("failed to load language files: %s\n", err)
|
fmt.Printf("failed to load language files: %s\n", err)
|
||||||
return 2
|
return 2
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/xxxserxxx/lingo"
|
"github.com/xxxserxxx/lingo/v2"
|
||||||
"github.com/shibukawa/configdir"
|
"github.com/shibukawa/configdir"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ package gotop
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -19,9 +20,12 @@ import (
|
||||||
"github.com/shibukawa/configdir"
|
"github.com/shibukawa/configdir"
|
||||||
"github.com/xxxserxxx/gotop/v4/colorschemes"
|
"github.com/xxxserxxx/gotop/v4/colorschemes"
|
||||||
"github.com/xxxserxxx/gotop/v4/widgets"
|
"github.com/xxxserxxx/gotop/v4/widgets"
|
||||||
"github.com/xxxserxxx/lingo"
|
"github.com/xxxserxxx/lingo/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed "dicts/*.toml"
|
||||||
|
var Dicts embed.FS
|
||||||
|
|
||||||
// CONFFILE is the name of the default config file
|
// CONFFILE is the name of the default config file
|
||||||
const CONFFILE = "gotop.conf"
|
const CONFFILE = "gotop.conf"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package devices
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"github.com/xxxserxxx/lingo"
|
"github.com/xxxserxxx/lingo/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
245
devices/smc.go
245
devices/smc.go
|
@ -1,245 +0,0 @@
|
||||||
// Code generated by go-bindata. (@generated) DO NOT EDIT.
|
|
||||||
|
|
||||||
//Package devices generated by go-bindata.// sources:
|
|
||||||
// devices/data/smc.tsv
|
|
||||||
package devices
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"compress/gzip"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func bindataRead(data []byte, name string) ([]byte, error) {
|
|
||||||
gz, err := gzip.NewReader(bytes.NewBuffer(data))
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("read %q: %v", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var buf bytes.Buffer
|
|
||||||
_, err = io.Copy(&buf, gz)
|
|
||||||
clErr := gz.Close()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("read %q: %v", name, err)
|
|
||||||
}
|
|
||||||
if clErr != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf.Bytes(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type asset struct {
|
|
||||||
bytes []byte
|
|
||||||
info os.FileInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
type bindataFileInfo struct {
|
|
||||||
name string
|
|
||||||
size int64
|
|
||||||
mode os.FileMode
|
|
||||||
modTime time.Time
|
|
||||||
}
|
|
||||||
|
|
||||||
// Name return file name
|
|
||||||
func (fi bindataFileInfo) Name() string {
|
|
||||||
return fi.name
|
|
||||||
}
|
|
||||||
|
|
||||||
// Size return file size
|
|
||||||
func (fi bindataFileInfo) Size() int64 {
|
|
||||||
return fi.size
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mode return file mode
|
|
||||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
|
||||||
return fi.mode
|
|
||||||
}
|
|
||||||
|
|
||||||
// ModTime return file modify time
|
|
||||||
func (fi bindataFileInfo) ModTime() time.Time {
|
|
||||||
return fi.modTime
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsDir return file whether a directory
|
|
||||||
func (fi bindataFileInfo) IsDir() bool {
|
|
||||||
return fi.mode&os.ModeDir != 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sys return file is sys mode
|
|
||||||
func (fi bindataFileInfo) Sys() interface{} {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var _smcTsv = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x95\xc1\x72\xab\x3a\x0f\xc7\xd7\x3d\x4f\xc1\xf0\x00\x1d\x4c\x92\x36\x67\x09\xa6\x05\x66\x42\xa2\x09\x29\x5f\x77\xdf\x10\xca\x6d\x99\x43\x02\x03\xf4\x9e\xe6\xed\xef\x58\xc6\xc6\x36\x64\xe9\x9f\x24\xdb\x92\xfe\xb2\xed\x13\x7d\xa7\xf6\x83\x0d\x2f\x34\xb6\x28\xbc\xd9\xbf\x18\x29\x4c\xe2\x80\xfd\x60\x53\x78\xb3\x88\x05\x5d\xf3\x53\x5d\xaa\xe1\xc6\x0d\x91\x34\x44\x65\x3e\xf4\xd5\xf5\x0f\xe7\xc1\x14\x90\x17\x7f\xf2\xcf\x92\xe3\x17\x81\xf9\xf2\x55\x5b\x12\x3a\x2e\x69\xd3\x95\x23\x73\x35\xe6\x22\x5b\x69\x6c\x85\x6c\xad\xb1\x35\xb2\x8d\xc6\x36\xc8\x9e\x34\xf6\x84\xec\x59\x63\xcf\xc8\xb6\x1a\xdb\x22\xf3\xe6\xc9\x5a\x5e\x3d\x3c\x72\xe3\x2c\xe3\xc9\x46\x44\xf9\x5c\xa3\x7c\x24\x92\x06\xad\x7c\x24\x98\x02\x94\xf2\x11\x51\x3e\x5e\x07\xf2\xaa\x2d\xfd\xf9\x66\xd3\x15\xfc\xd9\x8e\x93\x2d\x95\x0a\x48\x3d\x0e\x0a\x13\x78\x06\x08\x65\x48\x38\x4a\x24\x2c\x0c\x12\xa2\x68\x42\x78\xd3\x73\x0e\x51\x1a\x0c\x07\x15\x66\x15\x12\x13\xa0\xa8\x18\x50\x6b\x12\x92\x25\xda\x3b\xa9\xfd\x60\x27\xe5\xa5\xe9\x6e\xfa\x39\x09\x1e\x9f\x94\x17\xcb\xcf\x59\x21\x50\x4e\x09\xd1\x21\x16\x2e\xd9\x6a\xd0\xe7\x9e\xbf\x75\xc8\x3d\xc5\x69\x56\xd2\x7c\x7c\xd7\xa5\xdc\xd5\xc4\xe3\xbe\x06\x16\x3b\x9b\x18\xbd\xf7\x58\x97\x7d\xd3\x0d\x5f\xe7\xae\xfa\xf8\x2c\x45\x39\xf6\x98\x88\x6a\x90\x79\xf2\x19\xd9\x93\xfb\x0e\xe3\xd6\xac\x5b\x09\x8d\xa6\x2d\xa3\x11\xa8\xb5\x04\xbc\x01\x4c\x6e\x40\x4d\x80\x57\x61\x40\x2b\xb5\x87\xd8\xab\xba\x7f\xea\xe6\x2f\xbf\x93\x47\x54\x84\xb7\xf8\xc2\x43\xd9\x81\x6d\xd5\x8e\xe3\xfd\x45\x34\xc6\xfd\x5c\x8d\xe1\x78\x5f\x78\x33\xf3\xea\x7a\x6e\xf2\xee\x43\x3f\xbe\xe5\xb7\x6a\xfe\x96\xdd\x82\xb5\xe7\xd6\xbc\xbe\x58\xc7\xb2\x1f\x18\x3a\x23\xf2\x77\x54\xf7\xdc\x21\xde\xd1\x40\xc7\xff\x13\xd9\xb5\x4d\x37\xe8\xa6\x08\x4d\x51\x10\x58\x7e\x3e\x36\x23\x22\x2a\xc2\x84\x22\x57\x45\x98\x4f\xb4\x52\x11\xbe\x56\x07\xdc\xeb\xd0\x0e\x55\x91\xd7\x56\xd0\x55\xff\x62\xc9\x7d\xe7\xc4\xee\x9a\x0f\x43\xd9\xdd\xac\x53\xfa\xff\xc4\x7b\x47\x4e\x54\x8e\x47\xfb\xae\x8a\xf0\x68\x7f\xa5\x20\xa3\x56\x56\xfa\xdd\xb6\xf5\x18\xdb\xa2\x44\x74\x2e\x1f\x88\x96\xcc\x82\x5c\xce\x67\x41\xee\x14\xe4\xce\x82\x30\xf5\x76\x35\xe3\x98\x7f\xbb\x9e\x71\x7c\xb1\xdb\xcd\x8c\xe3\xab\x9d\xe2\x8d\x5f\x7e\xda\xfc\xda\x57\xcd\xd5\x4a\xeb\x66\xe8\xb9\x1a\x53\x14\x69\x8c\x88\x3d\xc7\x4d\x2f\x44\xb9\x60\xc1\x4c\x3c\x57\xb3\xb8\x4a\xcc\x6a\xc1\xc2\x62\x32\xea\xcc\xbe\xab\xcc\xf8\xc2\xb8\x9f\x3b\xfb\xae\x32\xe3\x0b\x5b\x23\x5b\xcf\xbe\xab\xcc\xf8\xc2\x9e\x90\x3d\xcd\xbe\xab\xcc\xf8\xc2\xd8\x77\x95\x65\xe4\x38\xb2\xec\x74\x62\x20\xc4\x0b\x87\xa3\x13\x23\x89\x73\x94\xaf\x27\x5b\xef\x31\x04\x68\x84\x0b\xf1\x6a\xb0\x45\xc0\x3d\xe5\x00\xa6\x8e\x75\xcc\xab\x1a\x4d\x1b\xc3\xb4\x91\x26\xc0\x28\xe2\x66\x92\x70\x9d\x31\x92\x15\x05\xde\x12\x2b\xcf\xa2\xad\x55\xc6\xc0\x71\x75\x94\xe0\x91\xa3\x8c\x48\x9f\x0d\x82\xc8\xd9\xe8\x20\xfb\x2d\x3d\x88\x8b\x24\x70\x8f\x06\xc9\x9e\x99\x8f\xf7\xfd\x53\xd5\x55\xde\xdd\xc6\xe3\x32\xec\x6f\x3a\xe4\xd7\x8f\xb3\x64\x5b\x95\xf1\x13\xca\x97\x51\x07\xa5\xd8\xcf\xf7\xf4\xd9\xca\xce\x98\x2d\x4d\x0e\xa9\x35\xd1\x58\x97\x09\x12\x29\x92\xac\x28\xe2\x03\x22\x57\x41\xf8\xc5\xc6\xd4\x11\xed\x1b\x6b\x17\xd3\x8d\x20\xc1\xd1\x4b\x90\x6c\x05\x81\xdd\x8e\x07\x85\x23\x08\x5f\xdf\x39\x48\x46\x20\xbb\x1c\x4f\x3a\x10\x3b\x27\xbc\xd5\xfc\x17\xa5\xcd\x75\xe8\x9a\xba\x2e\x3b\x6e\x9a\x24\x22\xfd\x55\x69\xc4\xf7\xa5\x11\xdf\x97\x46\x7c\xe0\x51\x55\x5f\x3c\x4a\xe6\x23\x13\x0f\x98\xa0\xe0\x63\x92\x5f\x79\xf7\x59\x76\x96\x9f\x1c\xf6\xf6\x2f\x1b\x16\xa6\x0f\x16\xa6\x0f\x16\xa6\x0f\x16\xa6\x0f\x16\xa6\x0f\x16\xa6\x0f\x16\xa6\x0f\x16\xa6\x0f\x28\xa8\xac\xe7\x48\x6f\x0e\x50\x08\xf4\x86\x02\x3d\x89\x86\x9e\x9a\x21\xaf\xb9\xd3\x6e\x86\x88\x21\x0d\x98\xa4\x31\x55\x1f\x42\xdc\x2c\x54\x23\x43\xe7\xa8\xb7\x1e\x96\xfa\x0b\x6a\x7f\x41\x3e\x0a\xd3\x69\x77\x3b\x0e\xf7\xc5\x00\xf7\xc5\x00\x91\xe3\xaa\x33\xaf\x70\x65\xce\x25\x6d\xcd\x57\x05\xf4\x61\x97\x78\x41\x63\xe0\xef\xe8\x5c\x63\xb0\xa8\x3c\x08\xb0\x80\x01\xb5\xe2\xeb\x54\xc2\x14\x61\x7a\xeb\x87\xf2\x22\xe8\x7f\x01\x00\x00\xff\xff\x1d\x32\xff\xb6\x46\x0d\x00\x00")
|
|
||||||
|
|
||||||
func smcTsvBytes() ([]byte, error) {
|
|
||||||
return bindataRead(
|
|
||||||
_smcTsv,
|
|
||||||
"smc.tsv",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func smcTsv() (*asset, error) {
|
|
||||||
bytes, err := smcTsvBytes()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
info := bindataFileInfo{name: "smc.tsv", size: 3398, mode: os.FileMode(420), modTime: time.Unix(1612389012, 0)}
|
|
||||||
a := &asset{bytes: bytes, info: info}
|
|
||||||
return a, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Asset loads and returns the asset for the given name.
|
|
||||||
// It returns an error if the asset could not be found or
|
|
||||||
// could not be loaded.
|
|
||||||
func Asset(name string) ([]byte, error) {
|
|
||||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
|
||||||
if f, ok := _bindata[cannonicalName]; ok {
|
|
||||||
a, err := f()
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
|
||||||
}
|
|
||||||
return a.bytes, nil
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("Asset %s not found", name)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MustAsset is like Asset but panics when Asset would return an error.
|
|
||||||
// It simplifies safe initialization of global variables.
|
|
||||||
func MustAsset(name string) []byte {
|
|
||||||
a, err := Asset(name)
|
|
||||||
if err != nil {
|
|
||||||
panic("asset: Asset(" + name + "): " + err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
|
|
||||||
// AssetInfo loads and returns the asset info for the given name.
|
|
||||||
// It returns an error if the asset could not be found or
|
|
||||||
// could not be loaded.
|
|
||||||
func AssetInfo(name string) (os.FileInfo, error) {
|
|
||||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
|
||||||
if f, ok := _bindata[cannonicalName]; ok {
|
|
||||||
a, err := f()
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
|
||||||
}
|
|
||||||
return a.info, nil
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
|
||||||
}
|
|
||||||
|
|
||||||
// AssetNames returns the names of the assets.
|
|
||||||
func AssetNames() []string {
|
|
||||||
names := make([]string, 0, len(_bindata))
|
|
||||||
for name := range _bindata {
|
|
||||||
names = append(names, name)
|
|
||||||
}
|
|
||||||
return names
|
|
||||||
}
|
|
||||||
|
|
||||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
|
||||||
var _bindata = map[string]func() (*asset, error){
|
|
||||||
"smc.tsv": smcTsv,
|
|
||||||
}
|
|
||||||
|
|
||||||
// AssetDir returns the file names below a certain
|
|
||||||
// directory embedded in the file by go-bindata.
|
|
||||||
// For example if you run go-bindata on data/... and data contains the
|
|
||||||
// following hierarchy:
|
|
||||||
// data/
|
|
||||||
// foo.txt
|
|
||||||
// img/
|
|
||||||
// a.png
|
|
||||||
// b.png
|
|
||||||
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
|
||||||
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
|
||||||
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
|
||||||
// AssetDir("") will return []string{"data"}.
|
|
||||||
func AssetDir(name string) ([]string, error) {
|
|
||||||
node := _bintree
|
|
||||||
if len(name) != 0 {
|
|
||||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
|
||||||
pathList := strings.Split(cannonicalName, "/")
|
|
||||||
for _, p := range pathList {
|
|
||||||
node = node.Children[p]
|
|
||||||
if node == nil {
|
|
||||||
return nil, fmt.Errorf("Asset %s not found", name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if node.Func != nil {
|
|
||||||
return nil, fmt.Errorf("Asset %s not found", name)
|
|
||||||
}
|
|
||||||
rv := make([]string, 0, len(node.Children))
|
|
||||||
for childName := range node.Children {
|
|
||||||
rv = append(rv, childName)
|
|
||||||
}
|
|
||||||
return rv, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type bintree struct {
|
|
||||||
Func func() (*asset, error)
|
|
||||||
Children map[string]*bintree
|
|
||||||
}
|
|
||||||
|
|
||||||
var _bintree = &bintree{nil, map[string]*bintree{
|
|
||||||
"smc.tsv": &bintree{smcTsv, map[string]*bintree{}},
|
|
||||||
}}
|
|
||||||
|
|
||||||
// RestoreAsset restores an asset under the given directory
|
|
||||||
func RestoreAsset(dir, name string) error {
|
|
||||||
data, err := Asset(name)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
info, err := AssetInfo(name)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RestoreAssets restores an asset under the given directory recursively
|
|
||||||
func RestoreAssets(dir, name string) error {
|
|
||||||
children, err := AssetDir(name)
|
|
||||||
// File
|
|
||||||
if err != nil {
|
|
||||||
return RestoreAsset(dir, name)
|
|
||||||
}
|
|
||||||
// Dir
|
|
||||||
for _, child := range children {
|
|
||||||
err = RestoreAssets(dir, filepath.Join(name, child))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func _filePath(dir, name string) string {
|
|
||||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
|
||||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
|
||||||
}
|
|
|
@ -4,9 +4,11 @@ package devices
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
_ "embed"
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
"github.com/shirou/gopsutil/host"
|
"github.com/shirou/gopsutil/host"
|
||||||
"io"
|
"io"
|
||||||
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// All possible thermometers
|
// All possible thermometers
|
||||||
|
@ -19,7 +21,7 @@ func devs() []string {
|
||||||
ids := loadIDs()
|
ids := loadIDs()
|
||||||
sensors, err := host.SensorsTemperatures()
|
sensors, err := host.SensorsTemperatures()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// FIXME log an error here
|
log.Printf("error getting sensor list for temps: %s", err)
|
||||||
return []string{}
|
return []string{}
|
||||||
}
|
}
|
||||||
rv := make([]string, 0, len(sensors))
|
rv := make([]string, 0, len(sensors))
|
||||||
|
@ -30,7 +32,7 @@ func devs() []string {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if label, ok := ids[sensor.SensorKey]; ok {
|
if label, ok := ids[sensor.SensorKey]; ok {
|
||||||
sensorMap[sensor.SensorKey] = label
|
sensorMap[sensor.SensorKey] = label
|
||||||
rv = append(rv, label)
|
rv = append(rv, label)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,22 +48,25 @@ func defs() []string {
|
||||||
return rv
|
return rv
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//go:embed "smc.tsv"
|
||||||
|
var smcData []byte
|
||||||
|
|
||||||
// loadIDs parses the embedded smc.tsv data that maps Darwin SMC
|
// loadIDs parses the embedded smc.tsv data that maps Darwin SMC
|
||||||
// sensor IDs to their human-readable labels into an array and returns the
|
// sensor IDs to their human-readable labels into an array and returns the
|
||||||
// array. The array keys are the 4-letter sensor keys; the values are the
|
// array. The array keys are the 4-letter sensor keys; the values are the
|
||||||
// human labels.
|
// human labels.
|
||||||
func loadIDs() map[string]string {
|
func loadIDs() map[string]string {
|
||||||
rv := make(map[string]string)
|
rv := make(map[string]string)
|
||||||
data, err := Asset("smc.tsv")
|
parser := csv.NewReader(bytes.NewReader(smcData))
|
||||||
parser := csv.NewReader(bytes.NewReader(data))
|
|
||||||
parser.Comma = '\t'
|
parser.Comma = '\t'
|
||||||
var line []string
|
var line []string
|
||||||
|
var err error
|
||||||
for {
|
for {
|
||||||
if line, err = parser.Read(); err == io.EOF {
|
if line, err = parser.Read(); err == io.EOF {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// FIXME log an error here
|
log.Printf("error parsing SMC tags for temp widget: %s", err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// The line is malformed if len(line) != 2, but because the asset is static
|
// The line is malformed if len(line) != 2, but because the asset is static
|
||||||
|
|
|
@ -3,9 +3,32 @@
|
||||||
package devices
|
package devices
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/csv"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func Test_NumCols(t *testing.T) {
|
||||||
|
parser := csv.NewReader(bytes.NewReader(smcData))
|
||||||
|
parser.Comma = '\t'
|
||||||
|
var line []string
|
||||||
|
for {
|
||||||
|
if line, err = parser.Read(); err == io.EOF {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("error parsing SMC tags for temp widget: %s", err)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
// The line is malformed if len(line) != 2, but because the asset is static
|
||||||
|
// it makes no sense to report the error to downstream users. This must be
|
||||||
|
// tested at/around compile time.
|
||||||
|
if len(line) == 2 {
|
||||||
|
t.Errorf("smc CSV data malformed: expected 2 columns, got %d", len(line))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func Test_loadIDs(t *testing.T) {
|
func Test_loadIDs(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
key string
|
key string
|
||||||
|
|
7
go.mod
7
go.mod
|
@ -9,7 +9,6 @@ require (
|
||||||
github.com/distatus/battery v0.10.0
|
github.com/distatus/battery v0.10.0
|
||||||
github.com/gizak/termui/v3 v3.1.0
|
github.com/gizak/termui/v3 v3.1.0
|
||||||
github.com/go-ole/go-ole v1.2.4 // indirect
|
github.com/go-ole/go-ole v1.2.4 // indirect
|
||||||
github.com/xxxserxxx/lingo v0.0.0-20210203173221-1a343cae68e0
|
|
||||||
github.com/mattn/go-runewidth v0.0.4
|
github.com/mattn/go-runewidth v0.0.4
|
||||||
github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 // indirect
|
github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 // indirect
|
||||||
github.com/onsi/ginkgo v1.14.2 // indirect
|
github.com/onsi/ginkgo v1.14.2 // indirect
|
||||||
|
@ -17,9 +16,11 @@ require (
|
||||||
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0
|
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0
|
||||||
github.com/shirou/gopsutil v3.20.12+incompatible
|
github.com/shirou/gopsutil v3.20.12+incompatible
|
||||||
github.com/stretchr/testify v1.4.0
|
github.com/stretchr/testify v1.4.0
|
||||||
|
github.com/xxxserxxx/lingo/v2 v2.0.1
|
||||||
github.com/xxxserxxx/opflag v1.0.5
|
github.com/xxxserxxx/opflag v1.0.5
|
||||||
golang.org/x/tools v0.1.0 // indirect
|
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 // indirect
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
|
||||||
howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 // indirect
|
howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
go 1.14
|
go 1.16
|
||||||
|
|
21
go.sum
21
go.sum
|
@ -27,11 +27,9 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x
|
||||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||||
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
|
|
||||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||||
|
@ -64,8 +62,6 @@ github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 h1:Xuk8ma/ibJ1
|
||||||
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0/go.mod h1:7AwjWCpdPhkSmNAgUv5C7EJ4AbmjEB3r047r3DXWu3Y=
|
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0/go.mod h1:7AwjWCpdPhkSmNAgUv5C7EJ4AbmjEB3r047r3DXWu3Y=
|
||||||
github.com/shirou/gopsutil v3.20.12+incompatible h1:6VEGkOXP/eP4o2Ilk8cSsX0PhOEfX6leqAnD+urrp9M=
|
github.com/shirou/gopsutil v3.20.12+incompatible h1:6VEGkOXP/eP4o2Ilk8cSsX0PhOEfX6leqAnD+urrp9M=
|
||||||
github.com/shirou/gopsutil v3.20.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
github.com/shirou/gopsutil v3.20.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk=
|
|
||||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
|
@ -73,25 +69,18 @@ github.com/valyala/fastrand v1.0.0 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2Obdk
|
||||||
github.com/valyala/fastrand v1.0.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
|
github.com/valyala/fastrand v1.0.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
|
||||||
github.com/valyala/histogram v1.0.1 h1:FzA7n2Tz/wKRMejgu3PV1vw3htAklTjjuoI6z3d4KDg=
|
github.com/valyala/histogram v1.0.1 h1:FzA7n2Tz/wKRMejgu3PV1vw3htAklTjjuoI6z3d4KDg=
|
||||||
github.com/valyala/histogram v1.0.1/go.mod h1:lQy0xA4wUz2+IUnf97SivorsJIp8FxsnRd6x25q7Mto=
|
github.com/valyala/histogram v1.0.1/go.mod h1:lQy0xA4wUz2+IUnf97SivorsJIp8FxsnRd6x25q7Mto=
|
||||||
github.com/xxxserxxx/lingo v0.0.0-20210203173221-1a343cae68e0 h1:Ru3WVLMLIpKyJ+RovEnjD/Kl2I7dnyhkldJPUc8eKdE=
|
github.com/xxxserxxx/lingo/v2 v2.0.1 h1:6uLLKzPqL0XpdFmNMmpSfu+uIzQk344ebfdpFWbGuxs=
|
||||||
github.com/xxxserxxx/lingo v0.0.0-20210203173221-1a343cae68e0/go.mod h1:SMupCha07PWCBui+1FLLBSJ9BybFvGiXdyogAMbUcFg=
|
github.com/xxxserxxx/lingo/v2 v2.0.1/go.mod h1:Hr6LTxpwirwJ2Qe83MvgSQARPFDzZ4S6DKd6ciuED7A=
|
||||||
github.com/xxxserxxx/opflag v1.0.5 h1:2H4Qtl1qe+dSkEcGt+fBe2mQ8z14MgkWPqcLaoa6k90=
|
github.com/xxxserxxx/opflag v1.0.5 h1:2H4Qtl1qe+dSkEcGt+fBe2mQ8z14MgkWPqcLaoa6k90=
|
||||||
github.com/xxxserxxx/opflag v1.0.5/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4=
|
github.com/xxxserxxx/opflag v1.0.5/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4=
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
|
||||||
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U=
|
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U=
|
||||||
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
@ -109,11 +98,6 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
|
|
||||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
@ -122,7 +106,6 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||||
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
|
|
||||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
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-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/xxxserxxx/lingo"
|
"github.com/xxxserxxx/lingo/v2"
|
||||||
"github.com/xxxserxxx/gotop/v4"
|
"github.com/xxxserxxx/gotop/v4"
|
||||||
"github.com/xxxserxxx/gotop/v4/widgets"
|
"github.com/xxxserxxx/gotop/v4/widgets"
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/xxxserxxx/lingo"
|
"github.com/xxxserxxx/lingo/v2"
|
||||||
"github.com/xxxserxxx/gotop/v4"
|
"github.com/xxxserxxx/gotop/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
. "github.com/gizak/termui/v3"
|
. "github.com/gizak/termui/v3"
|
||||||
"github.com/xxxserxxx/lingo"
|
"github.com/xxxserxxx/lingo/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Table struct {
|
type Table struct {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gizak/termui/v3/widgets"
|
"github.com/gizak/termui/v3/widgets"
|
||||||
lingo "github.com/xxxserxxx/lingo"
|
"github.com/xxxserxxx/lingo/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Used by all widgets
|
// Used by all widgets
|
||||||
|
|
Loading…
Reference in New Issue
Block a user