Fixes the help text issue. Moved some hard-coded strings to the translation files.
This commit is contained in:
parent
c0a06128a2
commit
9a56571373
@ -21,8 +21,8 @@ import (
|
||||
"github.com/VictoriaMetrics/metrics"
|
||||
jj "github.com/cloudfoundry-attic/jibber_jabber"
|
||||
ui "github.com/gizak/termui/v3"
|
||||
"github.com/jdkeke142/lingo-toml"
|
||||
"github.com/shibukawa/configdir"
|
||||
"github.com/xxxserxxx/lingo"
|
||||
"github.com/xxxserxxx/opflag"
|
||||
|
||||
"github.com/xxxserxxx/gotop/v4"
|
||||
@ -107,9 +107,9 @@ func parseArgs() error {
|
||||
if *list != "" {
|
||||
switch *list {
|
||||
case "layouts":
|
||||
fmt.Println(_layouts)
|
||||
fmt.Println(tr.Value("help.layouts"))
|
||||
case "colorschemes":
|
||||
fmt.Println(_colorschemes)
|
||||
fmt.Println(tr.Value("help.colorschemes"))
|
||||
case "paths":
|
||||
fmt.Println(tr.Value("help.paths"))
|
||||
paths := make([]string, 0)
|
||||
@ -122,9 +122,9 @@ func parseArgs() error {
|
||||
case "devices":
|
||||
listDevices()
|
||||
case "keys":
|
||||
fmt.Println(tr.Value("widget.help"))
|
||||
fmt.Println(tr.Value("help.help"))
|
||||
case "widgets":
|
||||
fmt.Println(_widgets)
|
||||
fmt.Println(tr.Value("help.widgets"))
|
||||
default:
|
||||
fmt.Printf(tr.Value("error.unknownopt", *list))
|
||||
os.Exit(1)
|
||||
@ -508,25 +508,3 @@ func listDevices() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const _layouts = `Built-in layouts:
|
||||
default
|
||||
minimal
|
||||
battery
|
||||
kitchensink`
|
||||
const _colorschemes = `Built-in colorschemes:
|
||||
default
|
||||
default-dark (for white background)
|
||||
solarized
|
||||
solarized16-dark
|
||||
solarized16-light
|
||||
monokai
|
||||
vice`
|
||||
const _widgets = `Widgets that can be used in layouts:
|
||||
cpu - CPU load graph
|
||||
mem - Physical & swap memory use graph
|
||||
temp - Sensor temperatures
|
||||
disk - Physical disk partition use
|
||||
power - A battery bar
|
||||
net - Network load
|
||||
procs - Interactive process list`
|
||||
|
4
go.mod
4
go.mod
@ -7,15 +7,17 @@ require (
|
||||
github.com/distatus/battery v0.9.0
|
||||
github.com/gizak/termui/v3 v3.1.0
|
||||
github.com/go-ole/go-ole v1.2.4 // indirect
|
||||
github.com/jdkeke142/lingo-toml v0.0.0-20200508150411-0ad65ccb786d
|
||||
github.com/mattn/go-runewidth v0.0.4
|
||||
github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1
|
||||
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0
|
||||
github.com/shirou/gopsutil v2.20.3+incompatible
|
||||
github.com/stretchr/testify v1.4.0
|
||||
github.com/xxxserxxx/lingo v1.1.0
|
||||
github.com/xxxserxxx/opflag v1.0.5
|
||||
golang.org/x/sys v0.0.0-20200316230553-a7d97aace0b0
|
||||
howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 // indirect
|
||||
)
|
||||
|
||||
go 1.14
|
||||
|
||||
replace github.com/jdkeke142/lingo-toml => github.com/xxxserxxx/lingo v0.0.0-20200619152803-440e0ec753ec
|
||||
|
6
go.sum
6
go.sum
@ -37,10 +37,8 @@ github.com/valyala/fastrand v1.0.0 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2Obdk
|
||||
github.com/valyala/fastrand v1.0.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
|
||||
github.com/valyala/histogram v1.0.1 h1:FzA7n2Tz/wKRMejgu3PV1vw3htAklTjjuoI6z3d4KDg=
|
||||
github.com/valyala/histogram v1.0.1/go.mod h1:lQy0xA4wUz2+IUnf97SivorsJIp8FxsnRd6x25q7Mto=
|
||||
github.com/xxxserxxx/lingo v1.0.1 h1:lPexOb0HEqYB50EaJdjaYFNATT8JhTcXljbQmCuXygE=
|
||||
github.com/xxxserxxx/lingo v1.0.1/go.mod h1:C2teIFiBLAmEhpLzRkwk7wP5R0eOoveXVYqD+5KOkAs=
|
||||
github.com/xxxserxxx/lingo v1.1.0 h1:UaA0oNyen0vGWNHD6eow+uCfBu7hhypwb28RxQSnprY=
|
||||
github.com/xxxserxxx/lingo v1.1.0/go.mod h1:C2teIFiBLAmEhpLzRkwk7wP5R0eOoveXVYqD+5KOkAs=
|
||||
github.com/xxxserxxx/lingo v0.0.0-20200619152803-440e0ec753ec h1:72Kid6wRHf4IZq0oJyJZGo4FuIyJeKqN4n9MEh2l744=
|
||||
github.com/xxxserxxx/lingo v0.0.0-20200619152803-440e0ec753ec/go.mod h1:Kji1cjs9t6xDSLWuz6vP6ockOTT1rIdMLnNryfHXVuw=
|
||||
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/sys v0.0.0-20200316230553-a7d97aace0b0 h1:4Khi5GeNOkZS5DqSBRn4Sy7BE6GuxwOqARPqfurkdNk=
|
||||
|
@ -7,6 +7,64 @@ total="Total"
|
||||
paths="Loadable colorschemes & layouts, and the config file, are searched for, in order:"
|
||||
log="The log file is in {0}"
|
||||
written="Config written to {0}"
|
||||
help="""
|
||||
Quit: q or <C-c>
|
||||
|
||||
Process navigation:
|
||||
- k and <Up>: up
|
||||
- j and <Down>: down
|
||||
- <C-u>: half page up
|
||||
- <C-d>: half page down
|
||||
- <C-b>: full page up
|
||||
- <C-f>: full page down
|
||||
- gg and <Home>: jump to top
|
||||
- G and <End>: jump to bottom
|
||||
|
||||
Process actions:
|
||||
- <Tab>: toggle process grouping
|
||||
- dd: kill selected process or group of processes with SIGTERM (15)
|
||||
- d3: kill selected process or group of processes with SIGQUIT (3)
|
||||
- d9: kill selected process or group of processes with SIGKILL (9)
|
||||
|
||||
Process sorting:
|
||||
- c: CPU
|
||||
- m: Mem
|
||||
- p: PID
|
||||
|
||||
Process filtering:
|
||||
- /: start editing filter
|
||||
- (while editing):
|
||||
- <Enter>: accept filter
|
||||
- <C-c> and <Escape>: clear filter
|
||||
|
||||
CPU and Mem graph scaling:
|
||||
- h: scale in
|
||||
- l: scale out
|
||||
|
||||
Network:
|
||||
- b: toggle between mbps and scaled bytes per second
|
||||
"""
|
||||
layouts = """Built-in layouts:
|
||||
default
|
||||
minimal
|
||||
battery
|
||||
kitchensink"""
|
||||
colorschemes = """Built-in colorschemes:
|
||||
default
|
||||
default-dark (for white background)
|
||||
solarized
|
||||
solarized16-dark
|
||||
solarized16-light
|
||||
monokai
|
||||
vice"""
|
||||
widgets = """Widgets that can be used in layouts:
|
||||
cpu - CPU load graph
|
||||
mem - Physical & swap memory use graph
|
||||
temp - Sensor temperatures
|
||||
disk - Physical disk partition use
|
||||
power - A battery bar
|
||||
net - Network load
|
||||
procs - Interactive process list"""
|
||||
|
||||
|
||||
[args]
|
||||
@ -61,43 +119,6 @@ temp=" Temperatures "
|
||||
net=" Network Usage "
|
||||
netint=" Network Usage: {0} "
|
||||
mem=" Memory Usage "
|
||||
help="""
|
||||
Quit: q or <C-c>
|
||||
|
||||
Process navigation:
|
||||
- k and <Up>: up
|
||||
- j and <Down>: down
|
||||
- <C-u>: half page up
|
||||
- <C-d>: half page down
|
||||
- <C-b>: full page up
|
||||
- <C-f>: full page down
|
||||
- gg and <Home>: jump to top
|
||||
- G and <End>: jump to bottom
|
||||
|
||||
Process actions:
|
||||
- <Tab>: toggle process grouping
|
||||
- dd: kill selected process or group of processes with SIGTERM (15)
|
||||
- d3: kill selected process or group of processes with SIGQUIT (3)
|
||||
- d9: kill selected process or group of processes with SIGKILL (9)
|
||||
|
||||
Process sorting:
|
||||
- c: CPU
|
||||
- m: Mem
|
||||
- p: PID
|
||||
|
||||
Process filtering:
|
||||
- /: start editing filter
|
||||
- (while editing):
|
||||
- <Enter>: accept filter
|
||||
- <C-c> and <Escape>: clear filter
|
||||
|
||||
CPU and Mem graph scaling:
|
||||
- h: scale in
|
||||
- l: scale out
|
||||
|
||||
Network:
|
||||
- b: toggle between mbps and scaled bytes per second
|
||||
"""
|
||||
|
||||
|
||||
[widget.net.err]
|
||||
|
@ -7,6 +7,64 @@ total="latoT"
|
||||
paths="redro ni ,rof dehcraes era ,elif gifnoc eht dna ,stuoyal & semehcsroloc elbadaoL:"
|
||||
log="ni si elif gol ehT {0}"
|
||||
written="ot nettirw gifnoC {0}"
|
||||
help="""
|
||||
>c-C< ro q :tiuQ
|
||||
|
||||
:noitagivan ssecorP
|
||||
pu :>pU< dna k -
|
||||
nwod :>nwoD< dna j -
|
||||
pu egap flah :>u-C< -
|
||||
nwod egap flah :>d-C< -
|
||||
pu egap lluf :>b-C< -
|
||||
nwod egap lluf :>f-C< -
|
||||
pot ot pmuj :>emoH< dna gg -
|
||||
mottob ot pmuj :>dnE< dna G -
|
||||
|
||||
:snoitca ssecorP
|
||||
gnipuorg ssecorp elggot :>baT< -
|
||||
)51( MRETGIS htiw sessecorp fo puorg ro ssecorp detceles llik :dd -
|
||||
)3( TIUQGIS htiw sessecorp fo puorg ro ssecorp detceles llik :3d -
|
||||
)9( LLIKGIS htiw sessecorp fo puorg ro ssecorp detceles llik :9d -
|
||||
|
||||
:gnitros ssecorP
|
||||
UPC :c -
|
||||
meM :m -
|
||||
DIP :p -
|
||||
|
||||
:gniretlif ssecorP
|
||||
retlif gnitide trats :/ -
|
||||
:)gnitide elihw( -
|
||||
retlif tpecca :>retnE< -
|
||||
retlif raelc :>epacsE< dna >c-C< -
|
||||
|
||||
:gnilacs hparg meM dna UPC
|
||||
ni elacs :h -
|
||||
tuo elacs :l -
|
||||
|
||||
:krowteN
|
||||
dnoces rep setyb delacs dna spbm neewteb elggot :b -
|
||||
"""
|
||||
layouts = """stuoyal ni-tliuB:
|
||||
tluafed
|
||||
laminim
|
||||
yrettab
|
||||
knisnehctik"""
|
||||
colorschemes = """semehcsroloc ni-tliuB:
|
||||
tluafed
|
||||
)dnuorgkcab etihw rof( krad-tluafed
|
||||
deziralos
|
||||
krad-61deziralos
|
||||
thgil-61deziralos
|
||||
iakonom
|
||||
eciv"""
|
||||
widgets = """stuoyal ni desu eb nac taht stegdiW:
|
||||
hparg daol UPC - upc
|
||||
hparg esu yromem paws & lacisyhP - mem
|
||||
serutarepmet rosneS - pmet
|
||||
esu noititrap ksid lacisyhP - ksid
|
||||
rab yrettab A - rewop
|
||||
daol krowteN - ten
|
||||
tsil ssecorp evitcaretnI - scorp"""
|
||||
|
||||
|
||||
[args]
|
||||
@ -61,43 +119,6 @@ temp=" serutarepmeT "
|
||||
net=" egasU krowteN "
|
||||
netint=" egasU krowteN: {0} "
|
||||
mem=" egasU yromeM "
|
||||
help="""
|
||||
>c-C< ro q :tiuQ
|
||||
|
||||
:noitagivan ssecorP
|
||||
pu :>pU< dna k -
|
||||
nwod :>nwoD< dna j -
|
||||
pu egap flah :>u-C< -
|
||||
nwod egap flah :>d-C< -
|
||||
pu egap lluf :>b-C< -
|
||||
nwod egap lluf :>f-C< -
|
||||
pot ot pmuj :>emoH< dna gg -
|
||||
mottob ot pmuj :>dnE< dna G -
|
||||
|
||||
:snoitca ssecorP
|
||||
gnipuorg ssecorp elggot :>baT< -
|
||||
)51( MRETGIS htiw sessecorp fo puorg ro ssecorp detceles llik :dd -
|
||||
)3( TIUQGIS htiw sessecorp fo puorg ro ssecorp detceles llik :3d -
|
||||
)9( LLIKGIS htiw sessecorp fo puorg ro ssecorp detceles llik :9d -
|
||||
|
||||
:gnitros ssecorP
|
||||
UPC :c -
|
||||
meM :m -
|
||||
DIP :p -
|
||||
|
||||
:gniretlif ssecorP
|
||||
retlif gnitide trats :/ -
|
||||
:)gnitide elihw( -
|
||||
retlif tpecca :>retnE< -
|
||||
retlif raelc :>epacsE< dna >c-C< -
|
||||
|
||||
:gnilacs hparg meM dna UPC
|
||||
ni elacs :h -
|
||||
tuo elacs :l -
|
||||
|
||||
:krowteN
|
||||
dnoces rep setyb delacs dna spbm neewteb elggot :b -
|
||||
"""
|
||||
|
||||
|
||||
[widget.net.err]
|
||||
|
@ -7,6 +7,43 @@ total="总计"
|
||||
paths="按顺序从以下位置优先读取配色方案、布局方案和配置文件:"
|
||||
log="日志文件位于 {0}"
|
||||
written="配置文件已写入 {0}"
|
||||
help="""
|
||||
退出: q or <C-c>
|
||||
|
||||
进程导航:
|
||||
- k 或 <Up>: 上一行
|
||||
- j 或 <Down>: 下一行
|
||||
- <C-u>: 上半页
|
||||
- <C-d>: 下半页
|
||||
- <C-b>: 上一页
|
||||
- <C-f>: 下一页
|
||||
- gg 或 <Home>: 到顶部
|
||||
- G 或 <End>: 到底部
|
||||
|
||||
进程操作:
|
||||
- <Tab>: 切换进程组
|
||||
- dd: 发送信号 SIGTERM (15) 终止进程或进程组
|
||||
- d3: 发送信号 SIGTERM (3) 终止进程或进程组
|
||||
- d9: 发送信号 SIGTERM (9) 终止进程或进程组
|
||||
|
||||
进程排序:
|
||||
- c: CPU
|
||||
- m: 内存
|
||||
- p: 进程标识
|
||||
|
||||
进程过滤:
|
||||
- /: 开始编辑过滤器
|
||||
- (编辑时):
|
||||
- <Enter>: 保存过滤器
|
||||
- <C-c> 或 <Escape>: 清除过滤器
|
||||
|
||||
CPU 和内存图形比例:
|
||||
- h: 放大比例
|
||||
- l: 缩小比例
|
||||
|
||||
网络:
|
||||
- b: 在 mbps 和 每秒字节数 之间切换
|
||||
"""
|
||||
|
||||
|
||||
[args]
|
||||
@ -61,43 +98,6 @@ temp=" 温度 "
|
||||
net=" 网络使用率 "
|
||||
netint=" 网络使用率: {0} "
|
||||
mem=" 内存使用率 "
|
||||
help="""
|
||||
退出: q or <C-c>
|
||||
|
||||
进程导航:
|
||||
- k 或 <Up>: 上一行
|
||||
- j 或 <Down>: 下一行
|
||||
- <C-u>: 上半页
|
||||
- <C-d>: 下半页
|
||||
- <C-b>: 上一页
|
||||
- <C-f>: 下一页
|
||||
- gg 或 <Home>: 到顶部
|
||||
- G 或 <End>: 到底部
|
||||
|
||||
进程操作:
|
||||
- <Tab>: 切换进程组
|
||||
- dd: 发送信号 SIGTERM (15) 终止进程或进程组
|
||||
- d3: 发送信号 SIGTERM (3) 终止进程或进程组
|
||||
- d9: 发送信号 SIGTERM (9) 终止进程或进程组
|
||||
|
||||
进程排序:
|
||||
- c: CPU
|
||||
- m: 内存
|
||||
- p: 进程标识
|
||||
|
||||
进程过滤:
|
||||
- /: 开始编辑过滤器
|
||||
- (编辑时):
|
||||
- <Enter>: 保存过滤器
|
||||
- <C-c> 或 <Escape>: 清除过滤器
|
||||
|
||||
CPU 和内存图形比例:
|
||||
- h: 放大比例
|
||||
- l: 缩小比例
|
||||
|
||||
网络:
|
||||
- b: 在 mbps 和 每秒字节数 之间切换
|
||||
"""
|
||||
|
||||
|
||||
[widget.net.err]
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
ui "github.com/gizak/termui/v3"
|
||||
"github.com/xxxserxxx/lingo"
|
||||
lingo "github.com/jdkeke142/lingo-toml"
|
||||
)
|
||||
|
||||
var tr lingo.Translations
|
||||
@ -17,7 +17,7 @@ type HelpMenu struct {
|
||||
|
||||
func NewHelpMenu(tra lingo.Translations) *HelpMenu {
|
||||
tr = tra
|
||||
keyBinds = tr.Value("widgets.help")
|
||||
keyBinds = tr.Value("help.help")
|
||||
return &HelpMenu{
|
||||
Block: *ui.NewBlock(),
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user