func TestCmd(t *testing.T) { // var cmd models.Cmd // cmd.Name = "dir" // cmd.Params = "" res, err := models.Run("dir", "") fmt.Println(res.Info) fmt.Println(err) }
func (this *CMDController) Post() { // var ob models.Object var cmd models.Cmd cmd.Command = this.Ctx.Input.Query("command") cmd.Params = this.Ctx.Input.Query("command") if cmd.Command != "" { res, e := models.Run(cmd.Command, "") if e != nil { fmt.Println("\n" + e.Error()) } // value, _ := json.Marshal(res) this.Data["json"] = res } else { // obs := models.GetAll() // this.Data["json"] = obs fmt.Println("The command is not exists.") this.Data["json"] = "The command is not exists." } this.ServeJson() }