summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorSean E. Russell <ser@ser1.net>2021-05-03 11:43:13 -0500
committerSean E. Russell <ser@ser1.net>2021-05-03 11:43:13 -0500
commit162ed50189ea602c857738789f5a8dd4adb11180 (patch)
tree2be775575b881213e00dc446b09dc18aa3727a83 /cmd
parente3cd3ebe5e960896b9515df054cea75df6ce2c89 (diff)
parent5a063376b0d63bfe57f35169dc1c754d3f7d16b0 (diff)
Merge branch 'go1.16'
Diffstat (limited to 'cmd')
-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..7f08626 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