xxxserxxx/gotop

Help text for --bytes is not shown correctly in some translations

andypiper opened this issue · 0 comments

gotop version:

gotop 4.1.3 (20220214T213516)

OS/Arch:
ProductName:	macOS
ProductVersion:	12.4
BuildVersion:	21F79
Terminal emulator:

iTerm 2

The output from gotop -h shows this (affected section only shown) - I'm running on a system where the language is set to English.

  -x, --export=         Enable metrics for export on the specified port.
  --mbps                Show network rate as mbps.
  --bytes               args.no-mbps <--- this is the issue
  --test                Runs tests and exits with success/failure code.
  --no-test             Disable tests.

As shown, the help text for the --bytes option shows the text args.no-mbps. This appears to be caused by this line of code:

mbps := goopt.Flag([]string{"--mbps"}, []string{"--bytes"}, tr.Value("args.mbps"), tr.Value("args.no-mbps"))

As shown, the parser attempts to print the translated text for the value of args.no-mbps which in some of the translations has been set, but in the English translation has instead been defined as the text for arg.bytes.

I'm not choosing to send a PR at this time as this affects several language translation files (most of which I'm not proficient with!) and also, the arg name has been set to no-mbps in some of the files, but left as bytes in other files. The fix itself should just be a case of choosing whether the arg name should be no-mbps or bytes; and then setting that arg name consistently across cmd/gotop/main.go and dict/*.toml.

Hope this helps!