package shell

import (
	"notabug.org/Umnik/GoAndroidSDK/v2/componets/executor"
	"notabug.org/Umnik/GoAndroidSDK/v2/componets/sdk/platformTools/adb/connection"
)

type DeviceShell struct {
	connection connection.Connection
}

func (d DeviceShell) Connection() connection.Connection {
	return d.connection
}

// Ls executes "ls" command with args (if passed) on device
func (d DeviceShell) Ls(lsPath string, args ...string) ([]byte, error) {
	fc := append(args, lsPath)
	return executor.RunSync(d, "ls", fc...)
}

// MkDir executes "mkdir" with args (if passed) on device
func (d DeviceShell) MkDir(dirPath string, args ...string) ([]byte, error) {
	fc := append([]string{dirPath}, args...)
	return executor.RunSync(d, "mkdir", fc...)
}

// Rm executes "rm" with args (if passed) on device
func (d DeviceShell) Rm(object string, args ...string) ([]byte, error) {
	fc := append([]string{object}, args...)
	return executor.RunSync(d, "rm", fc...)
}
