mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 08:09:45 +08:00
feat: add wiki sub-command to open httprunner website
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Release History
|
||||
|
||||
## v4.1.0 (2022-05-22)
|
||||
|
||||
- feat: add `wiki` sub-command to open httprunner website
|
||||
|
||||
## v4.1.0-beta (2022-05-21)
|
||||
|
||||
- feat: add pre-commit-hook to format go/python code
|
||||
|
||||
@@ -11,9 +11,10 @@ import (
|
||||
)
|
||||
|
||||
var scaffoldCmd = &cobra.Command{
|
||||
Use: "startproject $project_name",
|
||||
Short: "create a scaffold project",
|
||||
Args: cobra.ExactValidArgs(1),
|
||||
Use: "startproject $project_name",
|
||||
Aliases: []string{"scaffold"},
|
||||
Short: "create a scaffold project",
|
||||
Args: cobra.ExactValidArgs(1),
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
setLogLevel(logLevel)
|
||||
},
|
||||
|
||||
23
hrp/cmd/wiki.go
Normal file
23
hrp/cmd/wiki.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/wiki"
|
||||
)
|
||||
|
||||
var wikiCmd = &cobra.Command{
|
||||
Use: "wiki",
|
||||
Aliases: []string{"info", "docs", "doc"},
|
||||
Short: "visit https://httprunner.com",
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
setLogLevel(logLevel)
|
||||
},
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return wiki.OpenWiki()
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(wikiCmd)
|
||||
}
|
||||
12
hrp/internal/wiki/main.go
Normal file
12
hrp/internal/wiki/main.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package wiki
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func OpenWiki() error {
|
||||
log.Info().Msgf("%s https://httprunner.com", openCmd)
|
||||
return exec.Command(openCmd, "https://httprunner.com").Run()
|
||||
}
|
||||
3
hrp/internal/wiki/open_darwin.go
Normal file
3
hrp/internal/wiki/open_darwin.go
Normal file
@@ -0,0 +1,3 @@
|
||||
package wiki
|
||||
|
||||
const openCmd = "open"
|
||||
3
hrp/internal/wiki/open_linux.go
Normal file
3
hrp/internal/wiki/open_linux.go
Normal file
@@ -0,0 +1,3 @@
|
||||
package wiki
|
||||
|
||||
const openCmd = "xdg-open"
|
||||
3
hrp/internal/wiki/open_windows.go
Normal file
3
hrp/internal/wiki/open_windows.go
Normal file
@@ -0,0 +1,3 @@
|
||||
package wiki
|
||||
|
||||
const openCmd = "explorer"
|
||||
Reference in New Issue
Block a user