mirror of
https://github.com/tickstep/aliyunpan.git
synced 2025-01-23 14:32:14 +08:00
add run command for test
This commit is contained in:
parent
e33d23831a
commit
50a05a6bec
24
main.go
24
main.go
@ -20,6 +20,7 @@ import (
|
|||||||
"github.com/tickstep/aliyunpan/cmder/cmdtable"
|
"github.com/tickstep/aliyunpan/cmder/cmdtable"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
@ -600,6 +601,29 @@ func main() {
|
|||||||
HideHelp: true,
|
HideHelp: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 执行系统命令
|
||||||
|
{
|
||||||
|
Name: "run",
|
||||||
|
Usage: "执行系统命令",
|
||||||
|
Category: "其他",
|
||||||
|
Action: func(c *cli.Context) error {
|
||||||
|
if c.NArg() == 0 {
|
||||||
|
cli.ShowCommandHelp(c, c.Command.Name)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd := exec.Command(c.Args().First(), c.Args().Tail()...)
|
||||||
|
cmd.Stdout = os.Stdout
|
||||||
|
cmd.Stdin = os.Stdin
|
||||||
|
cmd.Stderr = os.Stderr
|
||||||
|
err := cmd.Run()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
// 调试用 debug
|
// 调试用 debug
|
||||||
//{
|
//{
|
||||||
// Name: "debug",
|
// Name: "debug",
|
||||||
|
Loading…
Reference in New Issue
Block a user