Skip to content

Commit

Permalink
Merge ../gotop-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxserxxx committed Feb 8, 2022
2 parents bfea0cd + 62e9bda commit 0f9c74e
Show file tree
Hide file tree
Showing 14 changed files with 137 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
uses: actions/checkout@master

- name: Compile
uses: xxxserxxx/actions/golang-build@v2.0.1
uses: xxxserxxx/actions/golang-build@v2.1.0
env:
SRCPATH: ./cmd/gotop
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
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
4 changes: 3 additions & 1 deletion .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@master

- name: Make binaries
uses: xxxserxxx/actions/golang-build@v2.0.1
uses: xxxserxxx/actions/golang-build@v2.1.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:
Expand All @@ -36,3 +36,5 @@ jobs:
files: |
.release/*.tgz
.release/*.zip
.release/*.rpm
.release/*.deb
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ If Go is not installed or is the wrong version, and you don't have root access o

#### go generate

With Go 1.16, it is no longer necessary to call `go generate`. Translations and Apple SMC tags are emded with `go:embed`.
With Go 1.16, it is no longer necessary to call `go generate`. Translations and Apple SMC tags are embedded with `go:embed`.

## Usage

Expand Down
33 changes: 33 additions & 0 deletions build/gotop.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Scale graphs to this level; 7 is the default, 2 is zoomed out.
graphhorizontalscale=7
# If true, start the UI with the help visible
helpvisible=false
# The color scheme to use. See `--list colorschemes`
colorscheme=default
# How frequently to update the UI, in nanoseconds
updateinterval=1000000000
# If true, show the average CPU load
averagecpu=false
# If true, show load per CPU
percpuload=true
# Temperature units. C for Celcius, F for Fahrenheit
tempscale=C
# If true, display a status bar
statusbar=false
# The network interface to monitor
netinterface=all
# A layout name. See `--list layouts`
layout=default
# The maximum log file size, in bytes
maxlogsize=5000000
# If set, export data as Promethius metrics on the interface:port.
# E.g., `:8080` (colon is required, interface is not)
#metricsexportport=
# Display network IO in mpbs if true
mbps=false
# A list of enabled temp sensors. See `--list devices`
#temperatures=
# Enable NVidia GPU metrics.
nvidia=false
# To configure the NVidia refresh rate, set a duration:
#nvidiarefresh=30s
42 changes: 27 additions & 15 deletions build/nfpm.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
name: "gotop"
arch: "amd64"
platform: "linux"
version: "v${VERSION}"
section: "default"
priority: "extra"
maintainer: "Sean Russell <ser@ser1.net>"
description: |
A terminal based graphical activity monitor inspired by gtop and vtop
vendor: "Sean Russell"
homepage: "https://github.com/xxxserxxx/gotop"
license: "GNU Affero General Public License v3.0"
bindir: "/usr/local/bin"
files:
build/gotop: "/usr/local/bin/gotop"
name: gotop
arch: amd64
platform: linux
version: v${VERSION}
version_schema: semver
version_metadata: git
section: default
priority: extra
maintainer: Sean Russell <ser@ser1.net>
description: A terminal based graphical activity monitor inspired by gtop and vtop
vendor: Sean Russell
homepage: https://github.com/xxxserxxx/gotop
license: The MIT License (Festival variant)
contents:
# The executable
- src: gotop
dst: /usr/bin/gotop

# Default configuration
- src: build/gotop.conf
dst: /etc/gotop/gotop.conf
type: config|noreplace

# Contributed layouts
- src: layouts/htop
dst: /etc/gotop/htop
type: config|noreplace
26 changes: 26 additions & 0 deletions cmd/gotop/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down
12 changes: 12 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions dicts/de_DE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,20 @@ color="Farbschema einstellen."
scale="Skalierungsfaktor der Graphen, >0"
version="Versionsangabe und Beenden."
percpu="Jede CPU im CPU-Widget anzeigen."
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."
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."
layout="Name der Layoutspezifikationsdatei für die Benutzeroberfläche. \"-\" liest aus Standard-Eingabe."
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."
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."
nvidiarefresh="Frequenz aktualisieren. Die meisten Zeiteinheiten werden akzeptiert."
Expand Down
5 changes: 5 additions & 0 deletions dicts/en_US.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
5 changes: 5 additions & 0 deletions dicts/eo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,20 @@ color="Agordi kloraj skemoj."
scale="Agordi grafilan skalon, >0"
version="Montri version kaj eliri."
percpu="Montri ĉiun CPU en la CPU-fenestraĵo."
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."
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."
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."
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"
nvidiarefresh="Refreŝigi oftecon. Plej multaj tempunuoj akceptis."
Expand Down
5 changes: 5 additions & 0 deletions dicts/es.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,20 @@ color="Establecer una esquema de colores ."
scale="Factor de escala de gráfico, >0"
version="Imprimir versión y salir."
percpu="Muestra cada CPU en el widget de CPU."
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."
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."
layout="Nombre de archivo de especificaciones de diseño para la interfaz de usuario. Use \"-\" para pipe."
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."
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"
nvidiarefresh="Frecuencia de actualización. Se aceptan la mayoría de las unidades de tiempo."
Expand Down
5 changes: 5 additions & 0 deletions dicts/fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,20 @@ color="Sélectionner un jeu de couleurs."
scale="Facteur de mise à l'échelle, >0"
version="Afficher la version et sortir."
percpu="Montrer chaque CPU dans le widget CPU."
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."
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."
layout="Nom du fichier de spécification de disposition pour l'interface utilisateur. Utiliser \"-\" pour l'entrée standard."
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."
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"
nvidiarefresh="Rafraîchir la fréquence. La plupart des unités de temps sont acceptées."
Expand Down
5 changes: 5 additions & 0 deletions dicts/tt_TT.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,20 @@ color=".emehcsroloc a teS"
scale="0> ,rotcaf elacs hparG"
version=".tixe dna noisrev tnirP"
percpu=".tegdiw UPC eht ni UPC hcae wohS"
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"
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"
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"
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"
nvidiarefresh=".detpecca stinu emit tsoM .ycneuqerf hserfeR"
Expand Down
3 changes: 3 additions & 0 deletions layouts/htop
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cpu mem
2:procs
net temp disk

0 comments on commit 0f9c74e

Please sign in to comment.