提交 e698b6b1 编写于 作者: yanghye's avatar yanghye

命令行工具 package 说明

上级 b1d1157c
......@@ -14,6 +14,9 @@ type Install struct {
}
type Package struct {
Path string `short:"p" long:"path" description:"Package directory"`
Mode string `short:"m" long:"mode" description:"Use mode to set online or offline, offline by default." default:"offline"`
Out string `short:"o" long:"out" description:"Output directory" default:"EnergyInstallPkg"`
}
type Command struct {
......
......@@ -21,11 +21,10 @@ func main() {
parser.WriteHelp(os.Stdout)
os.Exit(1)
}
if _, err := parser.ParseArgs(os.Args[1:]); err != nil {
if extraArgs, err := parser.ParseArgs(os.Args[1:]); err != nil {
fmt.Fprint(os.Stderr, err.Error()+"\n")
os.Exit(1)
} else {
//fmt.Println("retArgs:", retArgs)
switch parser.Active.Name {
case "install":
cc.Index = 1
......@@ -33,6 +32,10 @@ func main() {
cc.Index = 2
}
command := commands[cc.Index]
if len(extraArgs) < 1 {
fmt.Fprintf(os.Stderr, "%s\n%s", command.UsageLine, command.Long)
os.Exit(1)
}
fmt.Println("Energy executing:", command.Short)
if err := command.Run(cc); err != nil {
fmt.Fprint(os.Stderr, err.Error()+"\n")
......
......@@ -21,11 +21,18 @@ import (
)
var CmdInstall = &Command{
UsageLine: "install [path] [version] [name]",
UsageLine: "install -p [path] -v [version] -n [name]",
Short: "Automatically configure the CEF and Energy framework",
Long: `Automatically configure the CEF and Energy framework
During this process, CEF and Energy are downloaded
Default framework name is "CEFEnergy"`,
Long: `
-p Installation directory Default current directory
-v Specifying a version number,Default latest
-n Name of the frame after installation
Automatically configure the CEF and Energy framework.
During this process, CEF and Energy are downloaded.
Default framework name is "EnergyFramework".`,
}
const (
......
package cmd
import "fmt"
var CmdPackage = &Command{
UsageLine: "package",
UsageLine: "package -p [path] -m [model] -o [out]",
Short: "Making an Installation Package",
Long: `Making an Installation Package`,
Long: `
-p Package directory
-m Use mode to set online or offline, offline by default
-o Output directory
Making an Installation Package.
Set the package directory by specifying Path. The current directory is the default
Use mode to set online or offline, offline by default.
The framework is automatically downloaded when installed in online mode, installation package will be much smaller.
Offline mode makes the framework into the package,installation package will be large`,
}
func init() {
......@@ -11,5 +24,6 @@ func init() {
}
func runPackage(c *CommandConfig) error {
fmt.Println("runPackage", "mode:", c.Package.Mode, "path:", c.Package.Path, "out:", c.Package.Out)
return nil
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册