CommandFuncsBundle.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package Commands
  2. import (
  3. "golang.org/x/crypto/ssh/terminal"
  4. "git.swzry.com/NSMCServerLauncher/Utils"
  5. "path"
  6. "fmt"
  7. )
  8. func CMD_pwd_C(args []string, term *terminal.Terminal,context *Utils.UserContextType) {
  9. term.Write([]byte("PWD: " + context.PWD + "\n"))
  10. }
  11. func CMD_cd_C(args []string, term *terminal.Terminal,context *Utils.UserContextType) {
  12. stargs := Utils.RestrictQuotedArgs(args)
  13. fmt.Println(stargs)
  14. switch len(stargs) {
  15. case 0:
  16. term.Write([]byte("PWD: " + context.PWD + "\n"))
  17. break
  18. default:
  19. tpath := "/"
  20. if stargs[0][0] == '/'{
  21. tpath = path.Join("/",stargs[0][1:])
  22. }else{
  23. tpath = path.Join(context.PWD,stargs[0])
  24. }
  25. context.PWD = tpath
  26. //term.Write([]byte("PWD: " + context.PWD + "\n"))
  27. // TODO: Change PWD
  28. }
  29. }
  30. func CMD_mcstat_C(args []string, term *terminal.Terminal,context *Utils.UserContextType) {
  31. term.Write([]byte("Minecraft Server Not Running."))
  32. // TODO: Minecraft Status Display
  33. }
  34. func CMD_sz_C(args []string, term *terminal.Terminal,context *Utils.UserContextType) {
  35. term.Write([]byte("Not Support Yet."))
  36. // TODO: ZMODEM Transfer
  37. }