refactor platform logic and add gasorder domain
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// 平台 API 的版本命令行工具。
|
||||
// 平台 API 命令行工具。
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -8,12 +8,24 @@ import (
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Println("usage: platform-cli <version>")
|
||||
return
|
||||
}
|
||||
if os.Args[1] != "version" {
|
||||
fmt.Fprintf(os.Stderr, "unknown command: %s\n", os.Args[1])
|
||||
printUsage()
|
||||
os.Exit(1)
|
||||
}
|
||||
switch os.Args[1] {
|
||||
case "version":
|
||||
fmt.Println("platform-cli 0.1.0")
|
||||
case "resource-contract":
|
||||
if err := writeResourceContract(os.Stdout); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
default:
|
||||
fmt.Fprintf(os.Stderr, "unknown command: %s\n", os.Args[1])
|
||||
printUsage()
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Println("platform-cli 0.1.0")
|
||||
}
|
||||
|
||||
func printUsage() {
|
||||
fmt.Fprintln(os.Stderr, "usage: platform-cli <version|resource-contract>")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user