summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean E. Russell <ser@ser1.net>2020-04-23 13:38:22 -0500
committerSean E. Russell <ser@ser1.net>2020-04-23 13:38:22 -0500
commit61e080e51854fbaca0836e2be6eaf623153cdb0f (patch)
treec37140f266ed0101d2819b20055a24805303e713
parent32861bcca88ca9fb678244b2d1ba65d09d946acc (diff)
Remove deprecated command-line argumentsv3.6
-rw-r--r--CHANGELOG.md5
-rw-r--r--cmd/gotop/main.go2
-rw-r--r--config.go8
-rw-r--r--config_test.go7
4 files changed, 14 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5b67eab..a21d96e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,15 +27,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Instructions for Gentoo (thanks @tormath1!)
- Graph labels that don't fit (vertically) in the window are now drawn in additional columns (#40)
- Adds ability to filter reported temperatures (#92)
+- Command line option to list layouts, paths, colorschemes, hotkeys, and filterable devices
+- Adds ability to write out a configuration file
### Changed
- Log files stored in \$XDG_CACHE_HOME; DATA, CONFIG, CACHE, and RUNTIME are the only directories specified by the FreeDesktop spec.
- Extensions are now built with a build tool; this is an interim solution until issues with the Go plugin API are resolved.
+- Command line help text is cleaned up.
### Removed
- configdir, logdir, and logfile options in the config file are no longer used. gotop looks for a configuration file, layouts, and colorschemes in the following order: command-line; `pwd`; user-home, and finally a system-wide path. The paths depend on the OS and whether XDG is in use.
+- Removes the deprecated `--minimal` and `--battery` options. Use `-l minimal` and `-l battery` instead.
### Fixed
@@ -46,6 +50,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The disk code was truncating values instead of rounding (#90)
- Temperatures on Darwin were all over the place, and wrong (#48)
- Config file loading from `~/.config/gotop` wasn't working
+- There were a number of minor issues with the config file that have been cleaned up.
## [3.5.1] - 2020-04-09
diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go
index f13241b..5180baf 100644
--- a/cmd/gotop/main.go
+++ b/cmd/gotop/main.go
@@ -63,7 +63,6 @@ Usage: gotop [options]
Options:
-c, --color=NAME Set a colorscheme.
-h, --help Show this screen.
- -m, --minimal Only show CPU, Mem and Process widgets. (DEPRECATED, use '-l minimal')
-S, --graphscale=INT Graph scale factor, from 1+ [default: 7]
-r, --rate=RATE Number of times per second to update CPU and Mem widgets [default: 1].
-V, --version Print version and exit.
@@ -71,7 +70,6 @@ Options:
-a, --averagecpu Show average CPU in the CPU widget.
-f, --fahrenheit Show temperatures in fahrenheit.
-s, --statusbar Show a statusbar with the time.
- -b, --battery Show battery level widget (DEPRECATED, use '-l battery')
-B, --bandwidth=bits Specify the number of bits per seconds.
-l, --layout=NAME Name of layout spec file for the UI. Use "-" to pipe.
-i, --interface=NAME Select network interface [default: all]. Several interfaces can be defined using comma separated values. Interfaces can also be ignored using !
diff --git a/config.go b/config.go
index 0979806..19f7589 100644
--- a/config.go
+++ b/config.go
@@ -4,6 +4,7 @@ import (
"bufio"
"bytes"
"fmt"
+ "io"
"log"
"path/filepath"
"strconv"
@@ -49,7 +50,11 @@ func (conf *Config) Load() error {
} else {
return nil
}
- r := bufio.NewScanner(bytes.NewReader(in))
+ return load(bytes.NewReader(in), conf)
+}
+
+func load(in io.Reader, conf *Config) error {
+ r := bufio.NewScanner(in)
var lineNo int
for r.Scan() {
l := strings.TrimSpace(r.Text())
@@ -123,6 +128,7 @@ func (conf *Config) Load() error {
}
conf.Statusbar = bv
case netinterface:
+ // FIXME this should be a comma-separated list
conf.NetInterface = kv[1]
case layout:
conf.Layout = kv[1]
diff --git a/config_test.go b/config_test.go
index d567b8f..3f4c4b5 100644
--- a/config_test.go
+++ b/config_test.go
@@ -9,6 +9,7 @@ import (
"github.com/xxxserxxx/gotop/v3/widgets"
)
+// FIXME This is totally broken since the updates
func TestParse(t *testing.T) {
tests := []struct {
i string
@@ -37,8 +38,6 @@ func TestParse(t *testing.T) {
f: func(c Config, e error) {
assert.Nil(t, e, "unexpected error")
assert.Equal(t, "abc", c.ConfigDir)
- assert.Equal(t, "bar", c.LogDir)
- assert.Equal(t, "errors", c.LogFile)
},
},
{
@@ -46,8 +45,6 @@ func TestParse(t *testing.T) {
f: func(c Config, e error) {
assert.Nil(t, e, "unexpected error")
assert.Equal(t, "abc", c.ConfigDir)
- assert.Equal(t, "bar", c.LogDir)
- assert.Equal(t, "errors", c.LogFile)
},
},
{
@@ -81,7 +78,7 @@ func TestParse(t *testing.T) {
for _, tc := range tests {
in := strings.NewReader(tc.i)
c := Config{}
- e := Parse(in, &c)
+ e := load(in, &c)
tc.f(c, e)
}
}