mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-28 02:51:42 +08:00
docs: update hrp cmd docs
This commit is contained in:
16
cmd/cli/doc_test.go
Normal file
16
cmd/cli/doc_test.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/httprunner/httprunner/v5/cmd"
|
||||
"github.com/spf13/cobra/doc"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// run this test to generate markdown docs for hrp command
|
||||
func TestGenMarkdownTree(t *testing.T) {
|
||||
addAllCommands()
|
||||
err := doc.GenMarkdownTree(cmd.RootCmd, "../../docs/cmd")
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
@@ -7,8 +7,25 @@ import (
|
||||
"github.com/getsentry/sentry-go"
|
||||
|
||||
"github.com/httprunner/httprunner/v5/cmd"
|
||||
"github.com/httprunner/httprunner/v5/cmd/adb"
|
||||
"github.com/httprunner/httprunner/v5/cmd/ios"
|
||||
"github.com/httprunner/httprunner/v5/code"
|
||||
)
|
||||
|
||||
func addAllCommands() {
|
||||
// adds all child commands to the root command and sets flags appropriately.
|
||||
cmd.RootCmd.AddCommand(cmd.CmdBuild)
|
||||
cmd.RootCmd.AddCommand(cmd.CmdConvert)
|
||||
cmd.RootCmd.AddCommand(cmd.CmdPytest)
|
||||
cmd.RootCmd.AddCommand(cmd.CmdRun)
|
||||
cmd.RootCmd.AddCommand(cmd.CmdScaffold)
|
||||
cmd.RootCmd.AddCommand(cmd.CmdServer)
|
||||
cmd.RootCmd.AddCommand(cmd.CmdWiki)
|
||||
|
||||
cmd.RootCmd.AddCommand(ios.CmdIOSRoot)
|
||||
cmd.RootCmd.AddCommand(adb.CmdAndroidRoot)
|
||||
}
|
||||
|
||||
func main() {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
@@ -21,6 +38,9 @@ func main() {
|
||||
}
|
||||
}()
|
||||
|
||||
exitCode := cmd.Execute()
|
||||
addAllCommands()
|
||||
|
||||
err := cmd.RootCmd.Execute()
|
||||
exitCode := code.GetErrorCode(err)
|
||||
os.Exit(exitCode)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user