You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Victorique/vtqe/tools/attach.go

47 lines
1.0 KiB
Go

5 years ago
package tools
import (
"fmt"
"b612.me/starainrt"
"b612.me/starlog"
"github.com/spf13/cobra"
)
var attachcmd = &cobra.Command{
Use: "attach",
Short: "合并两个文件",
Long: "合并两个文件",
Run: func(this *cobra.Command, args []string) {
var src, dst, out string
if len(args) == 3 {
src = args[0]
dst = args[1]
out = args[2]
} else {
src, _ = this.Flags().GetString("src")
dst, _ = this.Flags().GetString("dst")
out, _ = this.Flags().GetString("out")
}
if src == "" || dst == "" {
starlog.StdPrintln(0, starlog.RED, "ERROR PATH")
5 years ago
this.Help()
return
}
cryp := new(starainrt.StarCrypto)
err := cryp.Attach(src, dst, out)
if err != nil {
starlog.StdPrintln(0, starlog.RED, err.Error)
5 years ago
} else {
fmt.Println("完成")
}
},
}
func init() {
attachcmd.Flags().StringP("src", "s", "", "源文件路径")
attachcmd.Flags().StringP("dst", "d", "", "目标文件路径")
attachcmd.Flags().StringP("out", "o", "", "输出文件路径")
Maincmd.AddCommand(attachcmd)
}