summaryrefslogtreecommitdiffstats
path: root/cmd/gotop/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/gotop/main.go')
-rw-r--r--cmd/gotop/main.go24
1 files changed, 16 insertions, 8 deletions
diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go
index 94f03a8..ec6c11e 100644
--- a/cmd/gotop/main.go
+++ b/cmd/gotop/main.go
@@ -5,6 +5,7 @@ import (
"flag"
"fmt"
"io"
+ "io/fs"
"io/ioutil"
"log"
"net/http"
@@ -22,7 +23,7 @@ import (
jj "github.com/cloudfoundry-attic/jibber_jabber"
ui "github.com/gizak/termui/v3"
"github.com/shibukawa/configdir"
- "github.com/xxxserxxx/lingo"
+ "github.com/xxxserxxx/lingo/v2"
"github.com/xxxserxxx/opflag"
"github.com/xxxserxxx/gotop/v4"
@@ -30,7 +31,6 @@ import (
"github.com/xxxserxxx/gotop/v4/devices"
"github.com/xxxserxxx/gotop/v4/layout"
"github.com/xxxserxxx/gotop/v4/logging"
- "github.com/xxxserxxx/gotop/v4/translations"
w "github.com/xxxserxxx/gotop/v4/widgets"
)
@@ -126,14 +126,22 @@ func parseArgs() error {
case "widgets":
fmt.Println(tr.Value("help.widgets"))
case "langs":
- vs, err := translations.AssetDir("")
+ err := fs.WalkDir(gotop.Dicts, ".", func(pth string, info fs.DirEntry, err error) error {
+ if err != nil {
+ return err
+ }
+ if info.IsDir() { // We skip these
+ return nil
+ }
+ fileName := info.Name()
+ if strings.HasSuffix(fileName, ".toml") {
+ fmt.Println(strings.TrimSuffix(fileName, ".toml"))
+ }
+ return nil
+ })
if err != nil {
return err
}
- for _, v := range vs {
- v = strings.TrimSuffix(v, ".toml")
- fmt.Println(v)
- }
default:
fmt.Printf(tr.Value("error.unknownopt", *list))
os.Exit(1)
@@ -366,7 +374,7 @@ func main() {
}
func run() int {
- ling, err := lingo.New("en_US", "", translations.AssetFile())
+ ling, err := lingo.New("en_US", ".", gotop.Dicts)
if err != nil {
fmt.Printf("failed to load language files: %s\n", err)
return 2