diff --git a/data/system/address/v1.xlsx b/data/system/address/v1.xlsx index 083d2fc1c585f2dcd26529538db878a01d39473e..efb197f754c2fdad379b678c1ea5a7dc8c46206a 100644 Binary files a/data/system/address/v1.xlsx and b/data/system/address/v1.xlsx differ diff --git a/data/system/misc/timetamp.yaml b/data/system/misc/timetamp.yaml deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/data/system/name/chinese-name.yaml b/data/system/name/chinese-name.yaml deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/data/system/name/english-name.yaml b/data/system/name/english-name.yaml deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/data/system/name/family-name.txt b/data/system/name/family-name.txt deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/data/system/name/first-name.txt b/data/system/name/first-name.txt deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/data/system/name/given-name.txt b/data/system/name/given-name.txt deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/data/system/name/last-name.txt b/data/system/name/last-name.txt deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/data/system/name/random-name.yaml b/data/system/name/random-name.yaml deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/res/en/messages.json b/res/en/messages.json index 5c9419ba961cc002dccc6ec73fadfe05974e82bb..6e55db8fbdac513de274feb6d7c2db4a587c1187 100644 --- a/res/en/messages.json +++ b/res/en/messages.json @@ -107,7 +107,7 @@ }, { "id": "excel_data", - "translation": "Excel Data." + "translation": "Excel Sheet." }, { "id": "excel_data_1", diff --git a/res/zh/messages.json b/res/zh/messages.json index 433c4d1b21b631363ec08f219bc7b5227fc43ab9..c2f16f8660024fec6165ca5e6464199420e2d5df 100644 --- a/res/zh/messages.json +++ b/res/zh/messages.json @@ -98,7 +98,7 @@ }, { "id": "excel_data", - "translation": "Excel数据源。" + "translation": "Excel数据表。" }, { "id": "excel_data_1", diff --git a/src/service/list.go b/src/service/list.go index 2dea859a66387dcd737d90a6984036ab5e131edd..5ed21a401fd63d3cb5b2aa64d3b3003f81e189cf 100644 --- a/src/service/list.go +++ b/src/service/list.go @@ -25,6 +25,7 @@ func ListRes() { GetFilesAndDirs(path, &res) msg := "" + names := make([]string, 0) nameWidth := 0 titleWidth := 0 for key, arr := range res { @@ -36,23 +37,51 @@ func ListRes() { } res[key] = arr - lent := runewidth.StringWidth(arr[1]) + name := pathToName(arr[1]) + names = append(names, name) + lent := runewidth.StringWidth(name) if lent > nameWidth { nameWidth = lent } - lent2 := runewidth.StringWidth(arr[2]) - if lent2 > titleWidth { - titleWidth = lent2 + + if key == "excel" { + sheets := strings.Split(arr[2], "|") + for _, sheet := range sheets { + lent2 := runewidth.StringWidth(sheet) + if lent2 > titleWidth { + titleWidth = lent2 + } + } + } else { + lent2 := runewidth.StringWidth(arr[2]) + if lent2 > titleWidth { + titleWidth = lent2 + } } + } + idx := 0 for _, arr := range res { - name := arr[1] - name = name + strings.Repeat(" ", nameWidth - runewidth.StringWidth(name)) - title := arr[2] - title = title + strings.Repeat(" ", titleWidth - runewidth.StringWidth(title)) + name := names[idx] + + titleStr := arr[2] + titles := strings.Split(titleStr, "|") + + idx2 := 0 + for _, title := range titles { + if idx2 > 0 { + name = "" + } + name = name + strings.Repeat(" ", nameWidth - runewidth.StringWidth(name)) + + title = title + strings.Repeat(" ", titleWidth - runewidth.StringWidth(title)) + msg = msg + fmt.Sprintf("%s %s %s\n", name, title, arr[3]) + + idx2++ + } - msg = msg + fmt.Sprintf("%s %s %s\n", name, title, arr[3]) + idx++ } logUtils.Screen(msg) @@ -70,7 +99,7 @@ func GetFilesAndDirs(path string, res *map[string][size]string) { } else { name := fi.Name() arr := [size]string{} - if strings.HasSuffix(name, ".yaml"){ + if strings.HasSuffix(name, ".yaml") { arr[0] = path + constant.PthSep + name arr[1] = path[strings.LastIndex(path, "system"):] + constant.PthSep + name (*res)["yaml"] = arr @@ -118,4 +147,11 @@ func readExcelInfo(path string) (title string, desc string) { desc = i118Utils.I118Prt.Sprintf("excel_data") return +} + +func pathToName(path string) string { + name := strings.ReplaceAll(path, constant.PthSep,".") + name = name[:strings.LastIndex(name, ".")] + + return name } \ No newline at end of file