mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-26 10:50:12 +08:00
feat: init scaffold
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// har2caseCmd represents the har2case command
|
// har2caseCmd represents the har2case command
|
||||||
var har2caseCmd = &cobra.Command{
|
var har2caseCmd = &cobra.Command{
|
||||||
Use: "har2case harPath...",
|
Use: "har2case $har_path...",
|
||||||
Short: "Convert HAR to json/yaml testcase files",
|
Short: "Convert HAR to json/yaml testcase files",
|
||||||
Long: `Convert HAR to json/yaml testcase files`,
|
Long: `Convert HAR to json/yaml testcase files`,
|
||||||
Args: cobra.MinimumNArgs(1),
|
Args: cobra.MinimumNArgs(1),
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
// runCmd represents the run command
|
// runCmd represents the run command
|
||||||
var runCmd = &cobra.Command{
|
var runCmd = &cobra.Command{
|
||||||
Use: "run path...",
|
Use: "run $path...",
|
||||||
Short: "run API test",
|
Short: "run API test",
|
||||||
Long: `run yaml/json testcase files for API test`,
|
Long: `run yaml/json testcase files for API test`,
|
||||||
Example: ` $ hrp run demo.json # run specified json testcase file
|
Example: ` $ hrp run demo.json # run specified json testcase file
|
||||||
|
|||||||
28
hrp/cmd/scaffold.go
Normal file
28
hrp/cmd/scaffold.go
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/httprunner/hrp/internal/builtin"
|
||||||
|
)
|
||||||
|
|
||||||
|
var scaffoldCmd = &cobra.Command{
|
||||||
|
Use: "startproject $project_name",
|
||||||
|
Short: "Create a scaffold project",
|
||||||
|
Args: cobra.ExactValidArgs(1),
|
||||||
|
PreRun: func(cmd *cobra.Command, args []string) {
|
||||||
|
setLogLevel(logLevel)
|
||||||
|
},
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
err := builtin.CreateScaffold(args[0])
|
||||||
|
if err != nil {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
RootCmd.AddCommand(scaffoldCmd)
|
||||||
|
}
|
||||||
17
internal/builtin/scaffold.go
Normal file
17
internal/builtin/scaffold.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package builtin
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/httprunner/hrp/internal/ga"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CreateScaffold(projectName string) error {
|
||||||
|
// report event
|
||||||
|
ga.SendEvent(ga.EventTracking{
|
||||||
|
Category: "Scaffold",
|
||||||
|
Action: "hrp startproject",
|
||||||
|
})
|
||||||
|
|
||||||
|
return fmt.Errorf("not implemented")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user