Merge branch 'fix-124' of github.com:mjshariati98/gotop
This commit is contained in:
commit
1163301362
|
@ -67,17 +67,23 @@ func parseArgs() error {
|
|||
version := opflag.BoolP("version", "v", false, tr.Value("args.version"))
|
||||
versioN := opflag.BoolP("", "V", false, tr.Value("args.version"))
|
||||
opflag.BoolVarP(&conf.PercpuLoad, "percpu", "p", conf.PercpuLoad, tr.Value("args.percpu"))
|
||||
opflag.BoolVar(&conf.NoPercpuLoad, "no-percpu", conf.NoPercpuLoad, tr.Value("args.no-percpu"))
|
||||
opflag.BoolVarP(&conf.AverageLoad, "averagecpu", "a", conf.AverageLoad, tr.Value("args.cpuavg"))
|
||||
opflag.BoolVar(&conf.NoAverageLoad, "no-averagecpu", conf.NoAverageLoad, tr.Value("args.no-cpuavg"))
|
||||
fahrenheit := opflag.BoolP("fahrenheit", "f", conf.TempScale == 'F', tr.Value("args.temp"))
|
||||
opflag.BoolVarP(&conf.Statusbar, "statusbar", "s", conf.Statusbar, tr.Value("args.statusbar"))
|
||||
opflag.BoolVar(&conf.NoStatusbar, "no-statusbar", conf.NoStatusbar, tr.Value("args.no-statusbar"))
|
||||
opflag.DurationVarP(&conf.UpdateInterval, "rate", "r", conf.UpdateInterval, tr.Value("args.rate"))
|
||||
opflag.StringVarP(&conf.Layout, "layout", "l", conf.Layout, tr.Value("args.layout"))
|
||||
opflag.StringVarP(&conf.NetInterface, "interface", "i", "all", tr.Value("args.net"))
|
||||
opflag.StringVarP(&conf.ExportPort, "export", "x", conf.ExportPort, tr.Value("args.export"))
|
||||
opflag.BoolVarP(&conf.Mbps, "mbps", "", conf.Mbps, tr.Value("args.mbps"))
|
||||
opflag.BoolVar(&conf.NoMbps, "no-mbps", conf.NoMbps, tr.Value("args.no-mbps"))
|
||||
opflag.BoolVar(&conf.Test, "test", conf.Test, tr.Value("args.test"))
|
||||
opflag.BoolVar(&conf.NoTest, "no-test", conf.NoTest, tr.Value("args.no-test"))
|
||||
opflag.StringP("", "C", "", tr.Value("args.conffile"))
|
||||
opflag.BoolVarP(&conf.Nvidia, "nvidia", "", conf.Nvidia, "Enable NVidia GPU support")
|
||||
opflag.BoolVarP(&conf.NoNvidia, "no-nvidia", "", conf.NoNvidia, "Disable NVidia GPU support")
|
||||
list := opflag.String("list", "", tr.Value("args.list"))
|
||||
wc := opflag.Bool("write-config", false, tr.Value("args.write"))
|
||||
opflag.SortFlags = false
|
||||
|
@ -161,6 +167,26 @@ func parseArgs() error {
|
|||
fmt.Println(tr.Value("help.written", path))
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if conf.NoStatusbar {
|
||||
conf.Statusbar = false
|
||||
}
|
||||
if conf.NoPercpuLoad {
|
||||
conf.PercpuLoad = false
|
||||
}
|
||||
if conf.NoAverageLoad {
|
||||
conf.AverageLoad = false
|
||||
}
|
||||
if conf.NoMbps {
|
||||
conf.Mbps = false
|
||||
}
|
||||
if conf.NoTest {
|
||||
conf.Test = false
|
||||
}
|
||||
if conf.NoNvidia {
|
||||
conf.Nvidia = false
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
12
config.go
12
config.go
|
@ -34,20 +34,26 @@ type Config struct {
|
|||
Colorscheme colorschemes.Colorscheme
|
||||
UpdateInterval time.Duration
|
||||
AverageLoad bool
|
||||
NoAverageLoad bool
|
||||
PercpuLoad bool
|
||||
NoPercpuLoad bool
|
||||
Statusbar bool
|
||||
NoStatusbar bool
|
||||
TempScale widgets.TempScale
|
||||
NetInterface string
|
||||
Layout string
|
||||
MaxLogSize int64
|
||||
ExportPort string
|
||||
Mbps bool
|
||||
NoMbps bool
|
||||
Temps []string
|
||||
Test bool
|
||||
NoTest bool
|
||||
ExtensionVars map[string]string
|
||||
ConfigFile string
|
||||
Tr lingo.Translations
|
||||
Nvidia bool
|
||||
NoNvidia bool
|
||||
NvidiaRefresh time.Duration
|
||||
}
|
||||
|
||||
|
@ -61,9 +67,15 @@ func NewConfig() Config {
|
|||
HelpVisible: false,
|
||||
UpdateInterval: time.Second,
|
||||
AverageLoad: false,
|
||||
NoAverageLoad: false,
|
||||
PercpuLoad: true,
|
||||
NoPercpuLoad: false,
|
||||
TempScale: widgets.Celsius,
|
||||
Statusbar: false,
|
||||
NoStatusbar: false,
|
||||
NoMbps: false,
|
||||
NoTest: false,
|
||||
NoNvidia: false,
|
||||
NetInterface: widgets.NetInterfaceAll,
|
||||
MaxLogSize: 5000000,
|
||||
Layout: "default",
|
||||
|
|
|
@ -77,15 +77,20 @@ color="Set a colorscheme."
|
|||
scale="Graph scale factor, >0"
|
||||
version="Print version and exit."
|
||||
percpu="Show each CPU in the CPU widget."
|
||||
no-percpu="Disable show each CPU in the CPU widget."
|
||||
cpuavg="Show average CPU in the CPU widget."
|
||||
no-cpuavg="Disable show average CPU in the CPU widget."
|
||||
temp="Show temperatures in fahrenheit."
|
||||
statusbar="Show a statusbar with the time."
|
||||
no-statusbar="Disable statusbar."
|
||||
rate="Refresh frequency. Most time units accepted. \"1m\" = refresh every minute. \"100ms\" = refresh every 100ms."
|
||||
layout="Name of layout spec file for the UI. Use \"-\" to pipe."
|
||||
net="Select network interface. Several interfaces can be defined using comma separated values. Interfaces can also be ignored using \"!\""
|
||||
export="Enable metrics for export on the specified port."
|
||||
mbps="Show network rate as mbps."
|
||||
no-mbps="Disable show network rate as mbps."
|
||||
test="Runs tests and exits with success/failure code."
|
||||
no-test="Disable tests."
|
||||
conffile="Config file to use instead of default (MUST BE FIRST ARGUMENT)"
|
||||
nvidia="Enable NVidia GPU metrics"
|
||||
nvidiarefresh="Refresh frequency. Most time units accepted."
|
||||
|
|
Loading…
Reference in New Issue
Block a user