37 lines
659 B
Go
37 lines
659 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/fatih/color"
|
||
|
|
||
|
"github.com/urfave/cli/v2"
|
||
|
)
|
||
|
|
||
|
// ActionApi API应用列表
|
||
|
func ActionApi(c *cli.Context) error {
|
||
|
// 读取配置
|
||
|
err := ReadConfig()
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
apiList := c.Args().Slice()
|
||
|
color.Green("API应用列表:")
|
||
|
for _, api := range config.Api.HasApp(apiList) {
|
||
|
color.Green("\t%s", api.Name)
|
||
|
color.Green("\t\t路径:\t%s", api.Root)
|
||
|
color.Green("\t\t类型:\t%s", api.Type)
|
||
|
color.Green("\t\t端口:\t%s", api.Port)
|
||
|
c := color.New(color.Bold)
|
||
|
c.EnableColor()
|
||
|
_, err := c.Println(healthApi(api))
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
fmt.Print("\n")
|
||
|
}
|
||
|
return nil
|
||
|
}
|