Remove deprecated command-line arguments

This commit is contained in:
Sean E. Russell 2020-04-23 13:38:22 -05:00
parent 32861bcca8
commit 61e080e518
4 changed files with 14 additions and 8 deletions

View File

@ -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

View File

@ -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 !

View File

@ -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]

View File

@ -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)
}
}