Skip to content

Commit

Permalink
添加一键注册功能,更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
821869798 committed Sep 6, 2023
1 parent 12ac8ac commit 886b576
Show file tree
Hide file tree
Showing 31 changed files with 727 additions and 310 deletions.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,33 @@ excel merge diff tools,excel对比合并工具,把excel转成csv格式,然

### 支持功能

- 支持xlsx、xlsm、xls
- 支持xlsx、xlsm、xls,支持多Sheet
- 支持excel对比 diff
- 支持excel合并 merge
- 支持作为TortoiseSVN和TortoiseGit以及其他能够自定义对比工具的版本控制软件,如果对比的不是excel文件,会直接调用对比工具。

## 使用方法

### windows

双击打开执行文件,允许权限(用于读取和修改注册表)

1. 选择基础的对比工具之后回车确定,如果有安装Beyond Comapre会识别出来

![select_comapre](doc/img/select_comapre.png)

2. 选择需要注册的scm版本工具,空格选择,回车确定,默认全选

![select_register](doc/img/select_register.png)

3. 注册完成,任意键关闭

![complete_register](E:\program\my\go\excel_merge\doc\img\complete_register.png)

4. 就可以正常使用了,比较示例如下,合并同理:

![diff](E:\program\my\go\excel_merge\doc\img\diff.png)

## TODO

- excel合并优化,考虑更多情况,保留更多格式数据
- excel合并保留更多格式数据
58 changes: 54 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package config

import (
"excel_merge/util"
"fmt"
"github.com/821869798/fankit/fanpath"
"github.com/BurntSushi/toml"
"os"
"regexp"
"runtime"
"strings"
)

type RawGlobalConfig struct {
Expand All @@ -13,13 +18,58 @@ type RawGlobalConfig struct {
MergeArgs string `toml:"merge_arg"`
}

var GlobalConfig *RawGlobalConfig
var (
GlobalConfig *RawGlobalConfig
ConfigFilePath string
)

func ParseConfig(configFile string) error {
configFile = util.AbsOrRelExecutePath(configFile)
ConfigFilePath = fanpath.AbsOrRelExecutePath(configFile)
GlobalConfig = new(RawGlobalConfig)
if _, err := toml.DecodeFile(configFile, GlobalConfig); err != nil {
if _, err := toml.DecodeFile(ConfigFilePath, GlobalConfig); err != nil {
return err
}
return nil
}

func WriteConfig(configFile string) error {
if configFile == "" {
configFile = ConfigFilePath
}
f, err := os.Create(configFile)
if err != nil {
return err
}
if err := toml.NewEncoder(f).Encode(GlobalConfig); err != nil {
return err
}
return nil
}

func UpdateCompareTool(newFilePath string) error {
content, err := os.ReadFile(ConfigFilePath)
if err != nil {
return err
}

// 定义正则表达式
pattern := `compare_exe\s*=\s*"(.*?)"`
regex := regexp.MustCompile(pattern)

if runtime.GOOS == "windows" {
// windows系统下,将路径中的反斜杠替换为双反斜杠
newFilePath = strings.ReplaceAll(newFilePath, "\\", "\\\\")
}
// 使用正则表达式替换字符串
newContent := regex.ReplaceAllString(string(content), fmt.Sprintf("compare_exe = \"%s\"", newFilePath))

// 将替换后的内容写入文件
err = os.WriteFile(ConfigFilePath, []byte(newContent), 0644)
if err != nil {
return err
}
return nil

// 选择需要注册的版本软件工具

}
2 changes: 1 addition & 1 deletion convert/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"bufio"
"bytes"
"encoding/csv"
"excel_merge/define"
"fmt"
"github.com/821869798/excel_merge/define"
"io"
"os"
"strings"
Expand Down
2 changes: 1 addition & 1 deletion convert/csv.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package convert

import (
"excel_merge/define"
"github.com/821869798/excel_merge/define"
)

type ConvertCSV struct {
Expand Down
2 changes: 1 addition & 1 deletion convert/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package convert

import (
"errors"
"excel_merge/define"
"fmt"
"github.com/821869798/excel_merge/define"
)

func RunConvert(mode string, excelData *define.ExcelData, filePath string) error {
Expand Down
2 changes: 1 addition & 1 deletion convert/register.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package convert

import (
"excel_merge/define"
"github.com/821869798/excel_merge/define"
)

var convertModes map[string]define.IConvert
Expand Down
10 changes: 10 additions & 0 deletions define/system.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package define

type SystemType int

const (
SystemTypeNone = iota
SystemTypeWindows
SystemTypeLinux
SystemTypeMac
)
17 changes: 9 additions & 8 deletions diff/diff.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package diff

import (
"excel_merge/config"
"excel_merge/convert"
"excel_merge/define"
"excel_merge/source"
"excel_merge/util"
"fmt"
"github.com/821869798/excel_merge/config"
"github.com/821869798/excel_merge/convert"
"github.com/821869798/excel_merge/define"
"github.com/821869798/excel_merge/source"
"github.com/821869798/fankit/fanpath"
"github.com/821869798/fankit/fanstr"
"github.com/gookit/slog"
"os"
"os/exec"
Expand All @@ -28,8 +29,8 @@ func Run(fileList []string) {
defer os.Remove(file2)
}

diffArg := util.FormatFieldName(config.GlobalConfig.DiffArgs, "left", file1, "right", file2)
cmd := exec.Command(util.AbsOrRelExecutePath(config.GlobalConfig.CompareTools), diffArg...)
diffArg := fanstr.FormatFieldName(config.GlobalConfig.DiffArgs, "left", file1, "right", file2)
cmd := exec.Command(fanpath.AbsOrRelExecutePath(config.GlobalConfig.CompareTools), diffArg...)
output, err := cmd.CombinedOutput()
exitCode := cmd.ProcessState.ExitCode()
if nil != err && !define.IsCompareExitCodeSafe(config.GlobalConfig.CompareTools, exitCode) {
Expand Down Expand Up @@ -62,7 +63,7 @@ func convertFile(file string) string {
return ""
}

err = util.CreateDirIfNoExist(filepath.Dir(outputFile))
err = fanpath.CreateDirIfNoExist(filepath.Dir(outputFile))
if err != nil {
slog.Panicf("[diff] %v", err)
return ""
Expand Down
2 changes: 1 addition & 1 deletion diff/diff_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package diff

import (
"excel_merge/util"
"github.com/821869798/excel_merge/util"
"os"
"strings"
"testing"
Expand Down
Binary file added doc/img/complete_register.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/select_comapre.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/select_register.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 15 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,27 +1,40 @@
module excel_merge
module github.com/821869798/excel_merge

go 1.20

require (
github.com/821869798/fankit v0.0.2
github.com/AlecAivazis/survey/v2 v2.3.7
github.com/BurntSushi/toml v1.3.2
github.com/gookit/slog v0.5.4
github.com/ncruces/zenity v0.10.10
github.com/xuri/excelize/v2 v2.7.1
golang.org/x/sys v0.10.0
)

require (
github.com/akavel/rsrc v0.10.2 // indirect
github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f // indirect
github.com/gookit/color v1.5.4 // indirect
github.com/gookit/goutil v0.6.12 // indirect
github.com/gookit/gsr v0.1.0 // indirect
github.com/josephspurrier/goversioninfo v1.4.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.8 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 // indirect
github.com/richardlehane/mscfb v1.0.4 // indirect
github.com/richardlehane/msoleps v1.0.3 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/xuri/efp v0.0.0-20220603152613-6918739fd470 // indirect
github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/image v0.10.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
)
37 changes: 36 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
github.com/821869798/fankit v0.0.1 h1:CrVbRsueDrzQqx/nSTsP1fR3NI06hncvXLIgW6jpnn0=
github.com/821869798/fankit v0.0.1/go.mod h1:73w1EUt6i92eswVBeuUVVmHtjidOqcVsmwL3beokqQA=
github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ=
github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo=
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw=
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI=
github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f h1:OGqDDftRTwrvUoL6pOG7rYTmWsTCvyEWFsMjg+HcOaA=
github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f/go.mod h1:Dv9D0NUlAsaQcGQZa5kc5mqR9ua72SmA8VXi4cd+cBw=
github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=
github.com/gookit/goutil v0.6.12 h1:73vPUcTtVGXbhSzBOFcnSB1aJl7Jq9np3RAE50yIDZc=
Expand All @@ -11,17 +23,34 @@ github.com/gookit/gsr v0.1.0 h1:0gadWaYGU4phMs0bma38t+Do5OZowRMEVlHv31p0Zig=
github.com/gookit/gsr v0.1.0/go.mod h1:7wv4Y4WCnil8+DlDYHBjidzrEzfHhXEoFjEA0pPPWpI=
github.com/gookit/slog v0.5.4 h1:EMctf/kap/SR8cnhkUucL0D3YZwUAJJ+WKQ/DN6kS5s=
github.com/gookit/slog v0.5.4/go.mod h1:awroa12zroMvjFpS7tdpTX12AqIzVewUlC10tsj4TYY=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
github.com/josephspurrier/goversioninfo v1.4.0 h1:Puhl12NSHUSALHSuzYwPYQkqa2E1+7SrtAPJorKK0C8=
github.com/josephspurrier/goversioninfo v1.4.0/go.mod h1:JWzv5rKQr+MmW+LvM412ToT/IkYDZjaclF2pKDss8IY=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/ncruces/zenity v0.10.10 h1:V/rtAhr5QLdDThahOkm7EYlnw4RuEsf7oN+Xb6lz1j0=
github.com/ncruces/zenity v0.10.10/go.mod h1:k3k4hJ4Wt1MUbeV48y+Gbl7Fp9skfGszN/xtKmuvhZk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 h1:GranzK4hv1/pqTIhMTXt2X8MmMOuH3hMeUR0o9SP5yc=
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844/go.mod h1:T1TLSfyWVBRXVGzWd0o9BI4kfoO9InEgfQe4NV3mLz8=
github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5ZawpM=
github.com/richardlehane/mscfb v1.0.4/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk=
github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
github.com/richardlehane/msoleps v1.0.3 h1:aznSZzrwYRl3rLKRT3gUk9am7T/mLNSnJINvN0AQoVM=
github.com/richardlehane/msoleps v1.0.3/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
Expand All @@ -36,13 +65,15 @@ github.com/xuri/excelize/v2 v2.7.1/go.mod h1:qc0+2j4TvAUrBw36ATtcTeC1VCM0fFdAXZO
github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 h1:OAmKAfT06//esDdpi/DZ8Qsdt4+M5+ltca05dA5bG2M=
github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E=
golang.org/x/image v0.5.0 h1:5JMiNunQeQw++mMOz48/ISeNu3Iweh/JaZU8ZLqHRrI=
golang.org/x/image v0.5.0/go.mod h1:FVC7BI/5Ym8R25iw5OLsgshdUBbT1h5jZTpA+mvAdZ4=
golang.org/x/image v0.10.0 h1:gXjUUtwtx5yOE0VKWq1CH4IJAClq4UGgUA3i+rpON9M=
golang.org/x/image v0.10.0/go.mod h1:jtrku+n79PfroUbvDdeUWMAI+heR786BofxrbiSF+J0=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
Expand All @@ -57,6 +88,7 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand All @@ -69,9 +101,12 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c=
golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
Expand Down
23 changes: 17 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package main

import (
"excel_merge/config"
"excel_merge/diff"
"excel_merge/merge"
"excel_merge/util"
"flag"
"fmt"
"github.com/821869798/excel_merge/config"
"github.com/821869798/excel_merge/diff"
"github.com/821869798/excel_merge/merge"
"github.com/821869798/excel_merge/register_tools"
"github.com/821869798/fankit/console"
"github.com/821869798/fankit/fanpath"
"github.com/gookit/slog"
"os"
)
Expand Down Expand Up @@ -39,12 +41,19 @@ func main() {
defer func() {
if err := recover(); err != nil {
slog.Errorf("[main] catch exception: %v", err)
util.AnyKeyToQuit()
console.AnyKeyToQuit()
os.Exit(1)
}
}()

err := config.ParseConfig(*conf)
// 初始化执行目录
err := fanpath.InitExecutePath()
if err != nil {
slog.Panicf("init execute path error:%v", err)
}

// 加载配置文件
err = config.ParseConfig(*conf)
if err != nil {
slog.Panicf("Load config toml file failed: %v", err)
} else {
Expand All @@ -70,6 +79,8 @@ func main() {
diff.Run(fileList)
} else if len(fileList) == 4 {
merge.Run(fileList)
} else if len(fileList) == 0 {
register_tools.Run()
} else {
usage()
}
Expand Down
Loading

0 comments on commit 886b576

Please sign in to comment.