Merge branch 'master' of ssh://gitea.digitalcircle.com.br:2222/open/replaycli-go

master
Pedro de Oliveira Guedes 2021-12-06 15:38:39 -03:00
commit f6853bc03c
1 changed files with 35 additions and 3 deletions

View File

@ -62,7 +62,7 @@ type DEVMODE struct {
/***************** Clip Functions *****************/
func (c *Cli) ClipRead() (string, error) {
bs, err := c.HttpCli().RawGet(fmt.Sprintf("/ipc/wingui/clip/read"))
bs, err := c.HttpCli().RawGet("/ipc/wingui/clip/read")
return string(bs), err
}
@ -74,7 +74,7 @@ func (c *Cli) ClipWrite(site string) error {
/***************** Mouse Functions *****************/
func (c *Cli) MouseClick() error {
err := c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/mouse/click"), nil)
err := c.HttpCli().JsonGet("/ipc/wingui/mouse/click", nil)
return err
}
@ -389,7 +389,7 @@ func (c *Cli) ScreenWaitClickCenter(f string, m int) ([]byte, error) {
}
func (c *Cli) ScreenRes() ([]byte, error) {
url := fmt.Sprintf("/ipc/wingui/screen/res")
url := "/ipc/wingui/screen/res"
ret, err := c.HttpCli().RawGet(url)
if err != nil {
@ -505,6 +505,38 @@ func (c *Cli) DialogWarn(t, m string) error {
return err
}
/***************** Process Functions *****************/
func (c *Cli) ProcAll() (ret []map[string]interface{}, err error) {
err = c.HttpCli().JsonGet("/ipc/wingui/proc/all", &ret)
return ret, err
}
func (c *Cli) ProcPids() (ret []int, err error) {
err = c.HttpCli().JsonGet("/ipc/wingui/proc/pids", &ret)
return ret, err
}
func (c *Cli) ProcKill(cmd int) (ret string, err error) {
err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/proc/kill?cmd=%d", cmd), &ret)
return ret, err
}
func (c *Cli) ProcExec(cmd string) error {
err := c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/proc/exec?cmd=%s", cmd), nil)
return err
}
func (c *Cli) ProcName(pid int) (ret string, err error) {
err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/proc/name?cmd=%d", pid), &ret)
return ret, err
}
func (c *Cli) ProcPath(pid int) (ret string, err error) {
err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/proc/path?cmd=%d", pid), &ret)
return ret, err
}
func NewCli() *Cli {
ret := &Cli{ApiCli: api.NewApiCli()}
return ret