From 66047ad64cf9211da7940d3c73b5811766591124 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" Date: Tue, 8 Feb 2022 16:50:30 -0600 Subject: [PATCH] Fixes #158, adding a man page. This replaces the flags library in the process. It also changes some of the new no- flags. --- .github/workflows/build.yml | 2 +- .github/workflows/prerelease.yml | 2 +- build/nfpm.yml | 8 ++- cmd/gotop/description.txt | 96 +++++++++++++++++++++++++ cmd/gotop/main.go | 118 +++++++++++++++---------------- config.go | 12 ---- devices/remote.go | 42 ++++++----- dicts/de_DE.toml | 4 +- dicts/en_US.toml | 10 +-- dicts/eo.toml | 4 +- dicts/es.toml | 4 +- dicts/fr.toml | 4 +- dicts/ru_RU.toml | 4 ++ dicts/tt_TT.toml | 4 +- dicts/zh_CN.toml | 3 + go.mod | 2 +- go.sum | 4 +- 17 files changed, 216 insertions(+), 107 deletions(-) create mode 100644 cmd/gotop/description.txt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55311a0..3c3b279 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@master - name: Compile - uses: xxxserxxx/actions/golang-build@v2.1.0 + uses: xxxserxxx/actions/golang-build@v2.2.0 env: SRCPATH: ./cmd/gotop with: diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index fdd7f5a..e859c24 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@master - name: Make binaries - uses: xxxserxxx/actions/golang-build@v2.1.0 + uses: xxxserxxx/actions/golang-build@v2.2.0 with: args: darwin/amd64/1 darwin/arm64/1 linux/amd64 linux/386 linux/arm64 linux/arm7 linux/arm6 linux/arm5 windows/amd64/1 windows/386/1 freebsd/amd64/1 env: diff --git a/build/nfpm.yml b/build/nfpm.yml index 1457308..6829e43 100644 --- a/build/nfpm.yml +++ b/build/nfpm.yml @@ -1,5 +1,5 @@ name: gotop -arch: amd64 +arch: ${GOARCH} platform: linux version: v${VERSION} version_schema: semver @@ -13,7 +13,7 @@ homepage: https://github.com/xxxserxxx/gotop license: The MIT License (Festival variant) contents: # The executable - - src: gotop + - src: ${EXECUTABLE} dst: /usr/bin/gotop # Default configuration @@ -25,3 +25,7 @@ contents: - src: layouts/htop dst: /etc/gotop/htop type: config|noreplace + + # Manpage + - src: ${MANPAGE} + dst: /usr/share/man8/gotop.8.gz diff --git a/cmd/gotop/description.txt b/cmd/gotop/description.txt new file mode 100644 index 0000000..eb038eb --- /dev/null +++ b/cmd/gotop/description.txt @@ -0,0 +1,96 @@ +gotop shows system information in a terminal UI. It can be configured to have +different layouts, color schemes, and widgets, and it is able to show +information from other computers. + +Anything you change on the command line can be written to a config file +using the `--write-config` argument, which can then be edited further. +Just get your arguments the way you like, then run gotop again with the same +arguments and the `--write-config` flag, and gotop will persist your +options. + +Colorschemes are json files; put them in the config directory (usually +~/.config/gotop/{name}.json) and load them with the `-c {name}` argument. +The keys are: + + Fg -- int, foreground color + Bg -- int, background color + BorderLabel -- int, color of widget text + BorderLine -- int, color of borders + CPULines -- array of ints for the colors of lines + BattLines -- array of ints for the colors of lines + MemLines -- array of ints for the colors of lines + ProcCursor -- int, color of the cursor in the process widget + Sparkline -- int, color of the graph bars + DiskBar -- int, color of the disk bars + TempLow -- int, color used for low temperatures + TempHigh -- int, color used for high temperatures + +For example: + + { "Fg": 7, "CPULines": [4, 3, 2, 1, 5, 6, 7, 8] } + +Colorschemes are referred to by their name minus the .json suffix. More +examples are here: + + https://github.com/xxxserxxx/gotop/tree/master/colorschemes + +Layout files are plain text files, with widget names on rows roughly representing +a grid. The format is ROWSPAN:WIDGETNAME/COLSPAN. COLSPAN is relative to the +rest of the line, so a line saying "cpu mem/3" will give the CPU widget 25% of +the width, and the memory widget 75% of the width. ROWSPAN is the height of +the widget, so "2:cpu mem" will make the CPU widget 2 rows high, and the memory +widget 1 row high. An example is: + + 2:cpu + disk/1 2:mem/2 + temp + 2:net 2:procs + +Save your layout under any file name either in the config directory or your current +directory and reference the file name with the `-l` argument. More details about +the rules are here: + + https://github.com/xxxserxxx/gotop/blob/master/docs/layouts.md + +and examples are here: + + https://github.com/xxxserxxx/gotop/tree/master/layouts + +gotop can function as both a metrics exporter and viewer. As an exporter, it +exports Prometheus metrics, and it does not handle either encryption or +authentication, and so should be run behind a reverse proxy. When gotop is run +with the `-x` argument, gotop will export metrics on the given port. To try it, +run + + gotop -x :8884 + +and then from another shell, run: + + curl http://localhost:8884/metrics + +To show these metrics in gotop, instead of curl run: + + gotop --remote-url http://localhost:8884/metrics + +You will see additional values in your widgets. To monitor remote machines, +run gotop on them with the `-x` export flag behind a reverse proxy such as +Caddy: + + myserver.net { + basicauth / gtuser gtpass + reverse-proxy /metrics http://localhost:8884 + } + +and then on your local gotop: + + gotop --remote-url https://gtuser:gtpass@myserver.net/metrics + +Config files, layouts, and color schemes are searched for (in order): + +- In the current directory +- In $XDG_CONFIG_DIR/gotop +- In /etc/gotop (on Linux and MacOS) + +More information and detailed documentation can found at +https://github.com/xxxserxxx/gotop` + diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go index da0208e..272eecc 100644 --- a/cmd/gotop/main.go +++ b/cmd/gotop/main.go @@ -2,6 +2,7 @@ package main import ( "bufio" + _ "embed" "flag" "fmt" "io" @@ -21,10 +22,10 @@ import ( "github.com/VictoriaMetrics/metrics" jj "github.com/cloudfoundry-attic/jibber_jabber" + "github.com/droundy/goopt" ui "github.com/gizak/termui/v3" "github.com/shibukawa/configdir" "github.com/xxxserxxx/lingo/v2" - "github.com/xxxserxxx/opflag" "github.com/xxxserxxx/gotop/v4" "github.com/xxxserxxx/gotop/v4/colorschemes" @@ -55,52 +56,71 @@ var ( tr lingo.Translations ) +//go:embed "description.txt" +var description string + func parseArgs() error { cds := conf.ConfigDir.QueryFolders(configdir.All) cpaths := make([]string, len(cds)) for i, p := range cds { cpaths[i] = p.Path } - help := opflag.BoolP("help", "h", false, tr.Value("args.help")) - color := opflag.StringP("color", "c", conf.Colorscheme.Name, tr.Value("args.color")) - opflag.IntVarP(&conf.GraphHorizontalScale, "graphscale", "S", conf.GraphHorizontalScale, tr.Value("args.scale")) - 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 - opflag.Usage = func() { - fmt.Fprintf(os.Stderr, tr.Value("usage", os.Args[0])) - opflag.PrintDefaults() - fmt.Fprintf(os.Stderr, "Project home: https://github.com/xxxserxxx/gotop\n") + goopt.Summary = "A terminal based graphical activity monitor, inspired by gtop and vtop" + goopt.Version = Version + goopt.Description = func() string { + return description } - opflag.Parse() - if *version || *versioN { + color := goopt.String([]string{"--color", "-c"}, conf.Colorscheme.Name, tr.Value("args.color")) + graphhorizontalscale := goopt.Int([]string{"--graphscale", "-S"}, conf.GraphHorizontalScale, tr.Value("args.scale")) + version := goopt.Flag([]string{"-v", "-V", "--version"}, []string{}, tr.Value("args.version"), "") + percpuload := goopt.Flag([]string{"--percpu", "-p"}, []string{"--no-percpu"}, tr.Value("args.percpu"), tr.Value("args.no-percpu")) + averageload := goopt.Flag([]string{"--averagecpu", "-a"}, []string{"--no-averagecpu"}, tr.Value("args.cpuavg"), tr.Value("args.no-cpuavg")) + tempScale := goopt.Flag([]string{"--fahrenheit"}, []string{"--celsius"}, tr.Value("args.temp"), tr.Value("args.tempc")) + statusbar := goopt.Flag([]string{"--statusbar", "-s"}, []string{"--no-statusbar"}, tr.Value("args.statusbar"), tr.Value("args.no-statusbar")) + updateinterval := goopt.String([]string{"--rate", "-r"}, conf.UpdateInterval.String(), tr.Value("args.rate")) + layout := goopt.String([]string{"--layout", "-l"}, conf.Layout, tr.Value("args.layout")) + netinterface := goopt.String([]string{"--interface", "-i"}, "all", tr.Value("args.net")) + exportport := goopt.String([]string{"--export", "-x"}, conf.ExportPort, tr.Value("args.export")) + mbps := goopt.Flag([]string{"--mbps"}, []string{"--bytes"}, tr.Value("args.mbps"), tr.Value("args.no-mbps")) + test := goopt.Flag([]string{"--test"}, []string{"--no-test"}, tr.Value("args.test"), tr.Value("args.no-test")) + // This is so the flag package doesn't barf on an unrecognized flag; it's processed earlier + goopt.String([]string{"-C"}, "", tr.Value("args.conffile")) + nvidia := goopt.Flag([]string{"--nvidia"}, []string{"--no-nvidia"}, tr.Value("args.nvidia"), tr.Value("args.no-nvidia")) + list := goopt.String([]string{"--list"}, "", tr.Value("args.list")) + wc := goopt.Flag([]string{"--write-config"}, []string{}, tr.Value("args.write"), "") + goopt.Parse(nil) + + conf.PercpuLoad = *percpuload + conf.GraphHorizontalScale = *graphhorizontalscale + conf.PercpuLoad = *percpuload + conf.AverageLoad = *averageload + conf.Statusbar = *statusbar + conf.Layout = *layout + conf.NetInterface = *netinterface + conf.ExportPort = *exportport + conf.Mbps = *mbps + conf.Nvidia = *nvidia + conf.AverageLoad = *averageload + conf.Test = *test + conf.Statusbar = *statusbar + conf.Mbps = *mbps + conf.Nvidia = *nvidia + if upInt, err := time.ParseDuration(*updateinterval); err == nil { + conf.UpdateInterval = upInt + } else { + fmt.Printf("Update interval must be a time interval such as '10s' or '1m'") + os.Exit(1) + } + if *tempScale { + conf.TempScale = 'F' + } else { + conf.TempScale = 'C' + } + + if *version { fmt.Printf("gotop %s (%s)\n", Version, BuildDate) os.Exit(0) } - if *help { - opflag.Usage() - os.Exit(0) - } if *color != "" { cs, err := colorschemes.FromName(conf.ConfigDir, *color) if err != nil { @@ -108,11 +128,6 @@ func parseArgs() error { } conf.Colorscheme = cs } - if *fahrenheit { - conf.TempScale = 'F' - } else { - conf.TempScale = 'C' - } if *list != "" { switch *list { case "layouts": @@ -170,25 +185,6 @@ func parseArgs() error { 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 } diff --git a/config.go b/config.go index d818285..7ff2947 100644 --- a/config.go +++ b/config.go @@ -34,26 +34,20 @@ 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 } @@ -67,15 +61,9 @@ 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", diff --git a/devices/remote.go b/devices/remote.go index 555df3e..9eadf13 100644 --- a/devices/remote.go +++ b/devices/remote.go @@ -10,11 +10,12 @@ import ( "sync" "time" - "github.com/xxxserxxx/opflag" + "github.com/droundy/goopt" ) -var name string -var remote_url string +var nameP *string +var remoteUrlP *string +var sleepP *string var sleep time.Duration var remoteLock sync.Mutex @@ -26,9 +27,9 @@ var remoteLock sync.Mutex // FIXME high CPU use when remote goes offline // FIXME higher CPU use when using remote in general func init() { - opflag.StringVarP(&name, "remote-name", "", "", "Remote: name of remote gotop") - opflag.StringVarP(&remote_url, "remote-url", "", "", "Remote: URL of remote gotop") - opflag.DurationVarP(&sleep, "remote-refresh", "", 0, "Remote: Frequency to refresh data, in seconds") + nameP = goopt.String([]string{"--remote-name"}, "", "Remote: name of remote gotop") + remoteUrlP = goopt.String([]string{"--remote-url"}, "", "Remote: URL of remote gotop") + sleepP = goopt.String([]string{"--remote-refresh"}, "", "Remote: Frequency to refresh data, in seconds") RegisterStartup(startup) } @@ -47,27 +48,34 @@ func startup(vars map[string]string) error { remoteLock = sync.Mutex{} remotes := parseConfig(vars) - // Don't set anything up if there's nothing to do - if (name == "" || remote_url == "") && len(remotes) == 0 { - return nil - } - if remote_url != "" { + + if remoteUrlP != nil && *remoteUrlP != "" { + var name string r := Remote{ - url: remote_url, - refresh: 2 * time.Second, + url: *remoteUrlP, + refresh: 5 * time.Second, } - if name == "" { + if nameP == nil && *nameP != "" { + name = *nameP + } else { name = "Remote" } - if sleep != 0 { - r.refresh = sleep + if sleepP == nil && *sleepP != "" { + sleep, err := time.ParseDuration(*sleepP) + if err == nil { + r.refresh = sleep + } else { + log.Printf("invalid refresh duration %s for %s; using default", *sleepP, *remoteUrlP) + } } remotes[name] = r } + if len(remotes) == 0 { log.Println("Remote: no remote URL provided; disabling extension") return nil } + RegisterTemp(updateTemp) RegisterMem(updateMem) RegisterCPU(updateUsage) @@ -83,7 +91,6 @@ func startup(vars map[string]string) error { w := &sync.WaitGroup{} for n, r := range remotes { n = n + "-" - r.url = r.url var u *url.URL w.Add(1) go func(name string, remote Remote, wg *sync.WaitGroup) { @@ -232,7 +239,6 @@ func updateUsage(cpus map[string]int, _ bool) map[string]error { func parseConfig(vars map[string]string) map[string]Remote { rv := make(map[string]Remote) - log.Printf("VARS = %s", vars) for key, value := range vars { if strings.HasPrefix(key, "remote-") { parts := strings.Split(key, "-") diff --git a/dicts/de_DE.toml b/dicts/de_DE.toml index 58897c4..edc74d8 100644 --- a/dicts/de_DE.toml +++ b/dicts/de_DE.toml @@ -81,6 +81,7 @@ no-percpu="Abschalten die CPU im CPU-Widget anzeigen." cpuavg="Durchschnittliche CPU im CPU-Widget anzeigen." no-cpuavg="Abschalten die Durchschnittliche CPU im CPU-Widget anzeigen." temp="Temperaturen in Fahrenheit anzeigen." +tempc="Temperaturen in Celsius anzeigen." statusbar="Statusleiste mit Uhrzeit anzeigen." no-statusbar="Abschalten die Statusleiste mit Uhrzeit anzeigen." rate="Frequenz aktualisieren. Die meisten Zeiteinheiten werden akzeptiert. \"1m\" = jede Minute aktualisieren. \"100 ms\" = alle 100 ms aktualisieren." @@ -88,11 +89,12 @@ layout="Name der Layoutspezifikationsdatei für die Benutzeroberfläche. \"-\" l net="Netzwerkschnittstelle auswählen. Mehrere Schnittstellen können durch Kommata getrennt werden. Schnittstellen mit \"!\" werden ignoriert." export="Metriken für den Export auf dem angegebenen Port aktivieren." mbps="Netzwerkrate als MBit/s anzeigen." -no-mbps="Abschalten die Netzwerkrate als MBit/s anzeigen." +bytes="Netzwerkrate als bytes/s anzeigen." test="Tests ausführen und mit Erfolgs- oder Fehlercode beenden." no-test="Abschalten Tests" conffile="Konfigurationsdatei, die anstelle der Standardeinstellung verwendet werden soll (muss ERSTES ARGUMENT sein)." nvidia="NVidia-GPU-Metriken aktivieren." +no-nvidia="NVidia-GPU-Metriken abschalten." nvidiarefresh="Frequenz aktualisieren. Die meisten Zeiteinheiten werden akzeptiert." list=""" Auflisten von diff --git a/dicts/en_US.toml b/dicts/en_US.toml index 87e3526..30dacfa 100644 --- a/dicts/en_US.toml +++ b/dicts/en_US.toml @@ -77,10 +77,11 @@ 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." +no-percpu="Show aggregate 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." +tempc="Show temperatures in celsius." 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." @@ -88,11 +89,12 @@ 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." +bytes="Show network rate as bytes." 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" +conffile="Config file to use instead of default (MUST BE FIRST ARGUMENT)." +nvidia="Enable NVidia GPU metrics." +no-nvidia="Disable NVidia GPU metrics." nvidiarefresh="Refresh frequency. Most time units accepted." # TRANSLATORS: Please don't translate the **labels** ("devices", "layouts") as they don't change in the code. list=""" diff --git a/dicts/eo.toml b/dicts/eo.toml index 6ec5ad7..7371fa2 100644 --- a/dicts/eo.toml +++ b/dicts/eo.toml @@ -81,6 +81,7 @@ no-percpu="Malŝalti montri ĉiun CPU en la CPU-fenestraĵo." cpuavg="Montri duonan CPU en la CPU-fenestraĵo." no-cpuavg="Malŝalti montri duonan CPU en la CPU-fenestraĵo." temp="Montri temperaturojn en fahrenheit." +tempc="Montri temperaturojn en celsius." statusbar="Montri statusbarbaron kun la tempo." no-statusbar="Malŝalti montri statusbarbaron kun la tempo." rate="Refreŝiga ofteco. Plej multaj unuoj akceptitaj. \"1m\" = refreŝigi ĉiun minuton. \"100ms\" = refreŝigi ĉiun dekonon minuton." @@ -88,11 +89,12 @@ layout="Nomo de aranĝa specifa dosiero por la UI. Uzu \"-\" por pipi." net="Elekti retinterfacon. Multaj interfacoj povas esti difinitaj per komparaj valoroj. Interfacoj ankaŭ povas esti ignorataj per \"!\"" export="Ebligu metrikojn por eksportado en la specifita haveno." mbps="Montri reta takson kiel mbps." -no-mbps="Malŝalti montri reta takson kiel mbps." +bytes="Malŝalti montri reta takson kiel bajtoj." test="Ekzekutas testojn kaj forirojn kun sukceso / fiaska kodo." no-test="Malŝalti ekzekutas testojn kaj forirojn kun sukceso / fiaska kodo." conffile="Agordi dosiero por uzi anstataŭ defaŭlte (DEVAS ESTI UNUA ARGUMENTO)" nvidia="Ebligu NVidia GPU-metrikojn" +no-nvidia="Malŝalti NVidia GPU-metrikojn" nvidiarefresh="Refreŝigi oftecon. Plej multaj tempunuoj akceptis." # TRANSLATORS: Please don't translate the list entries list=""" diff --git a/dicts/es.toml b/dicts/es.toml index 7a04aef..bb4f3d1 100644 --- a/dicts/es.toml +++ b/dicts/es.toml @@ -81,6 +81,7 @@ no-percpu="Inutilizar muestra cada CPU en el widget de CPU." cpuavg="Mostrar uso de CPU promedio en el widget de CPU." no-cpuavg="Inutilizar mostrar uso de CPU promedio en el widget de CPU." temp="Mostrar temperaturas en grados Fahrenheit." +tempc="Mostrar temperaturas en grados Celsius." statusbar="Muestra una barra de estado con la hora." no-statusbar="Inutilizar muestra una barra de estado con la hora." rate="Actualizar frecuencia. Se aceptan la mayoría de las unidades de tiempo. \"1m\" = actualizar cada minuto. \"100ms\" = actualizar cada 100ms." @@ -88,11 +89,12 @@ layout="Nombre de archivo de especificaciones de diseño para la interfaz de usu net="Seleccionar interfaz de red. Se pueden definir varias interfaces utilizando valores separados por comas. Interfaces también se pueden ignorar usando \"!\"" export="Habilitar métricas para exportar en el puerto especificado." mbps="Muestra la velocidad de la red como mbps." -no-mbps="Inutilizar muestra la velocidad de la red como mbps." +bytes="Inutilizar muestra la velocidad de la red como bytes." test="Ejecuta pruebas y sale con código de éxito / error." no-test="Inutilizar ejecuta pruebas y sale con código de éxito / error." conffile="Archivo de configuración para usar en lugar de predeterminado (DEBE SER EL PRIMER ARGUMENTO)" nvidia="Habilitar métrica de NVidia GPU" +nonvidia="Inutilizar métrica de NVidia GPU" nvidiarefresh="Frecuencia de actualización. Se aceptan la mayoría de las unidades de tiempo." # TRANSLATORS: Please don't translate the **labels** ("devices", "layouts") as they don't change in the code. list=""" diff --git a/dicts/fr.toml b/dicts/fr.toml index d780522..e694ed3 100644 --- a/dicts/fr.toml +++ b/dicts/fr.toml @@ -81,6 +81,7 @@ no-percpu="Désactiver montrer chaque CPU dans le widget CPU." cpuavg="Montrer le CPU moyen dans le widget CPU." no-cpuavg="Désactiver montrer le CPU moyen dans le widget CPU." temp="Montrer les températures en fahrenheit." +tempc="Montrer les températures en celsius." statusbar="Montrer une barre d'état avec l'heure." no-statusbar="Désactiver montrer une barre d'état avec l'heure." rate="Fréquence de rafraîchissement. La plupart des unités de temps sont acceptées. \"1m\" = rafraîchir toutes les minutes. \"100ms\" = rafraîchir toutes les 100ms." @@ -88,11 +89,12 @@ layout="Nom du fichier de spécification de disposition pour l'interface utilisa net="Choisir l'interface réseau. Plusieurs interfaces peuvent être décrites en les séparant par des virgules. Elles peuvent aussi être ignorées avec \"!\"" export="Activer l'export des mesures sur le port indiqué." mbps="Montrer le débit réseau en mbps." -no-mbps="Désactiver montrer le débit réseau en mbps." +bytes="Désactiver montrer le débit réseau en bytes." test="Lancer les tests et sortir avec le code de succès ou d'échec." no-test="Désactiver lancer les tests et sortir avec le code de succès ou d'échec." conffile="Fichier de configuration à utiliser au lieu du fichier par défaut (DOIT ÊTRE PASSÉ EN PREMIER)" nvidia="Activer les métriques GPU NVidia" +no-nvidia="Désactiver les métriques GPU NVidia" nvidiarefresh="Rafraîchir la fréquence. La plupart des unités de temps sont acceptées." # TRANSLATORS: Please don't translate the **labels** ("devices", "layouts") as they don't change in the code. list=""" diff --git a/dicts/ru_RU.toml b/dicts/ru_RU.toml index 68dec8a..2656d18 100644 --- a/dicts/ru_RU.toml +++ b/dicts/ru_RU.toml @@ -73,14 +73,18 @@ version="Напечатать версию и выйти." percpu="Показать каждый CPU в CPU виджете." cpuavg="Показать средний CPU в CPU виджете." temp="Показать температуру в фаренгейтах." +tempc="Show temperatures in celsius." statusbar="Показать статусбар со временем." rate="Частота обновления. Поддерживается большинство единиц измерения. \"1m\" = обновлять каждую минуту. \"100ms\" = обновлять каждые 100мс." layout="Название файла спецификации для раскладки. Используйте \"-\" для нескольких раскладок." net="Выбрать сетевой интерфейс. Несколько интерфейсов можно определить через запятую. Для игнорирования определённых интерфейсов используйте \"!\"" export="Включить метрику для экспорта на указанном порту." mbps="Показать скорость сети в мб/с" +bytes="Show network rate as bytes." test="Запуск тестов и выход с успешным/провальным кодом." conffile="Файл конфигурации вместо того, что по умолчанию (ДОЛЖЕН БЫТЬ ПЕРВЫМ АРГУМЕНТОМ)" +nvidia="Enable NVidia GPU metrics." +nvidiarefresh="Refresh frequency. Most time units accepted." # TRANSLATORS: Please don't translate the **labels** ("devices", "layouts") as they don't change in the code. list=""" Перечислить diff --git a/dicts/tt_TT.toml b/dicts/tt_TT.toml index d6faa02..3e778bc 100644 --- a/dicts/tt_TT.toml +++ b/dicts/tt_TT.toml @@ -80,6 +80,7 @@ no-percpu=".tegdiw UPC eht ni UPC hcae wohs elbasiD" cpuavg=".tegdiw UPC eht ni UPC egareva wohS" no-cpuavg=".tegdiw UPC eht ni UPC egareva wohs elbasiD" temp=".tiehnerhaf ni serutarepmet wohS.tiehnerhaf ni serutarepmet wohS" +tempc=".suislec ni serutarepmet wohS.tiehnerhaf ni serutarepmet wohS" statusbar=".emit eht htiw rabsutats a wohS" no-statusbar=".emit eht htiw rabsutats a wohs elbasiD" rate=".sm001 yreve hserfer = \"sm001\" .etunim yreve hserfer = \"m1\" .detpecca stinu emit tsoM .ycneuqerf hserfeR" @@ -87,11 +88,12 @@ layout="Name of layout spec file for the UI. Use \"-\" to pipe." net="gnisu derongi eb osla nac secafretnI .seulav detarapes ammoc gnisu denifed eb nac secafretni lareveS .ecafretni krowten tceleS \"!\"" export=".trop deificeps eht no tropxe rof scirtem elbanE" mbps=".spbm sa etar krowten wohS" -no-mbps=".spbm sa etar krowten wohs elbasiD" +bytes=".setyb sa etar krowten wohs elbasiD" test=".edoc eruliaf/sseccus htiw stixe dna stset snuR" no-test=".edoc eruliaf/sseccus htiw stixe dna stset snur elbasiD" conffile=")TNEMUGRA TSRIF EB TSUM( tluafed fo daetsni esu ot elif gifnoC" nvidia="scirtem UPG aidiVN elbanE" +no-nvidia="scirtem UPG aidiVN elbasiD" nvidiarefresh=".detpecca stinu emit tsoM .ycneuqerf hserfeR" list=""" >snart|syek|shtap|semehcsroloc|stuoyal|secived< tsiL diff --git a/dicts/zh_CN.toml b/dicts/zh_CN.toml index 010f603..8ba874a 100644 --- a/dicts/zh_CN.toml +++ b/dicts/zh_CN.toml @@ -79,15 +79,18 @@ version="显示版本并退出。" percpu="在 CPU 组件中显示每个 CPU。" cpuavg="在 CPU 组件中平均 CPU。" temp="显示华氏温度。" +tempc="Show temperatures in celsius." statusbar="显示时间状态栏。" rate="刷新频率。常见的时间单位皆可用。\"1m\" = 每分钟刷新。\"100ms\" = 每100毫秒刷新。" layout="布局描述文件名。使用 \"-\" 连接。" net="选择网卡。多个网卡用逗号分隔。使用 \"!\" 忽略指定网卡。" export="在指定端口上启用指标输出。" mbps="显示网速为 mbps。" +bytes="Show network rate as bytes." test="执行测试并返回成功或失败码。" conffile="用于替代缺省参数的配置文件(必须是第一个参数)" nvidia="启用NVidia GPU指标" +no-nvidia="Disable NVidia GPU metrics." nvidiarefresh="刷新频率。接受了大多数时间单位。" list=""" 列出 diff --git a/go.mod b/go.mod index b8bc904..674f2f3 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/cloudfoundry-attic/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 // indirect github.com/distatus/battery v0.10.0 + github.com/droundy/goopt v0.0.0-20170604162106-0b8effe182da github.com/gizak/termui/v3 v3.1.0 github.com/go-ole/go-ole v1.2.4 // indirect github.com/mattn/go-runewidth v0.0.4 @@ -17,7 +18,6 @@ require ( github.com/shirou/gopsutil v3.20.12+incompatible github.com/stretchr/testify v1.4.0 github.com/xxxserxxx/lingo/v2 v2.0.1 - github.com/xxxserxxx/opflag v1.0.5 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 diff --git a/go.sum b/go.sum index ba7423e..912ffa9 100644 --- a/go.sum +++ b/go.sum @@ -14,6 +14,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/distatus/battery v0.10.0 h1:YbizvmV33mqqC1fPCAEaQGV3bBhfYOfM+2XmL+mvt5o= github.com/distatus/battery v0.10.0/go.mod h1:STnSvFLX//eEpkaN7qWRxCWxrWOcssTDgnG4yqq9BRE= +github.com/droundy/goopt v0.0.0-20170604162106-0b8effe182da h1:79H+mNJWOObWrQgbkSvvZ3t/D2lKWaTi9mu/v7fNRvg= +github.com/droundy/goopt v0.0.0-20170604162106-0b8effe182da/go.mod h1:ytRJ64WkuW4kf6/tuYqBATBCRFUP8X9+LDtgcvE+koI= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -71,8 +73,6 @@ github.com/valyala/histogram v1.0.1 h1:FzA7n2Tz/wKRMejgu3PV1vw3htAklTjjuoI6z3d4K github.com/valyala/histogram v1.0.1/go.mod h1:lQy0xA4wUz2+IUnf97SivorsJIp8FxsnRd6x25q7Mto= github.com/xxxserxxx/lingo/v2 v2.0.1 h1:6uLLKzPqL0XpdFmNMmpSfu+uIzQk344ebfdpFWbGuxs= 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/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=