Merge pull request #11 from zach-klippenstein/package-rename
Renamed top-level package from `goadb` to just `adb`.
This commit is contained in:
commit
c4de7097d7
|
@ -36,13 +36,13 @@ var (
|
||||||
pushRemoteArg = pushCommand.Arg("remote", "Path of destination file on device.").Required().String()
|
pushRemoteArg = pushCommand.Arg("remote", "Path of destination file on device.").Required().String()
|
||||||
)
|
)
|
||||||
|
|
||||||
var server goadb.Server
|
var server adb.Server
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var exitCode int
|
var exitCode int
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
server, err = goadb.NewServer(goadb.ServerConfig{})
|
server, err = adb.NewServer(adb.ServerConfig{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "error:", err)
|
fmt.Fprintln(os.Stderr, "error:", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -62,16 +62,16 @@ func main() {
|
||||||
os.Exit(exitCode)
|
os.Exit(exitCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseDevice() goadb.DeviceDescriptor {
|
func parseDevice() adb.DeviceDescriptor {
|
||||||
if *serial != "" {
|
if *serial != "" {
|
||||||
return goadb.DeviceWithSerial(*serial)
|
return adb.DeviceWithSerial(*serial)
|
||||||
}
|
}
|
||||||
|
|
||||||
return goadb.AnyDevice()
|
return adb.AnyDevice()
|
||||||
}
|
}
|
||||||
|
|
||||||
func listDevices(long bool) int {
|
func listDevices(long bool) int {
|
||||||
client := goadb.NewHostClient(server)
|
client := adb.NewHostClient(server)
|
||||||
devices, err := client.ListDevices()
|
devices, err := client.ListDevices()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "error:", err)
|
fmt.Fprintln(os.Stderr, "error:", err)
|
||||||
|
@ -94,7 +94,7 @@ func listDevices(long bool) int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func runShellCommand(commandAndArgs []string, device goadb.DeviceDescriptor) int {
|
func runShellCommand(commandAndArgs []string, device adb.DeviceDescriptor) int {
|
||||||
if len(commandAndArgs) == 0 {
|
if len(commandAndArgs) == 0 {
|
||||||
fmt.Fprintln(os.Stderr, "error: no command")
|
fmt.Fprintln(os.Stderr, "error: no command")
|
||||||
kingpin.Usage()
|
kingpin.Usage()
|
||||||
|
@ -108,7 +108,7 @@ func runShellCommand(commandAndArgs []string, device goadb.DeviceDescriptor) int
|
||||||
args = commandAndArgs[1:]
|
args = commandAndArgs[1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
client := goadb.NewDeviceClient(server, device)
|
client := adb.NewDeviceClient(server, device)
|
||||||
output, err := client.RunCommand(command, args...)
|
output, err := client.RunCommand(command, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "error:", err)
|
fmt.Fprintln(os.Stderr, "error:", err)
|
||||||
|
@ -119,7 +119,7 @@ func runShellCommand(commandAndArgs []string, device goadb.DeviceDescriptor) int
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func pull(showProgress bool, remotePath, localPath string, device goadb.DeviceDescriptor) int {
|
func pull(showProgress bool, remotePath, localPath string, device adb.DeviceDescriptor) int {
|
||||||
if remotePath == "" {
|
if remotePath == "" {
|
||||||
fmt.Fprintln(os.Stderr, "error: must specify remote file")
|
fmt.Fprintln(os.Stderr, "error: must specify remote file")
|
||||||
kingpin.Usage()
|
kingpin.Usage()
|
||||||
|
@ -130,7 +130,7 @@ func pull(showProgress bool, remotePath, localPath string, device goadb.DeviceDe
|
||||||
localPath = filepath.Base(remotePath)
|
localPath = filepath.Base(remotePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
client := goadb.NewDeviceClient(server, device)
|
client := adb.NewDeviceClient(server, device)
|
||||||
|
|
||||||
info, err := client.Stat(remotePath)
|
info, err := client.Stat(remotePath)
|
||||||
if util.HasErrCode(err, util.FileNoExistError) {
|
if util.HasErrCode(err, util.FileNoExistError) {
|
||||||
|
@ -167,7 +167,7 @@ func pull(showProgress bool, remotePath, localPath string, device goadb.DeviceDe
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func push(showProgress bool, localPath, remotePath string, device goadb.DeviceDescriptor) int {
|
func push(showProgress bool, localPath, remotePath string, device adb.DeviceDescriptor) int {
|
||||||
if remotePath == "" {
|
if remotePath == "" {
|
||||||
fmt.Fprintln(os.Stderr, "error: must specify remote file")
|
fmt.Fprintln(os.Stderr, "error: must specify remote file")
|
||||||
kingpin.Usage()
|
kingpin.Usage()
|
||||||
|
@ -184,7 +184,7 @@ func push(showProgress bool, localPath, remotePath string, device goadb.DeviceDe
|
||||||
localFile = os.Stdin
|
localFile = os.Stdin
|
||||||
// 0 size will hide the progress bar.
|
// 0 size will hide the progress bar.
|
||||||
perms = os.FileMode(0660)
|
perms = os.FileMode(0660)
|
||||||
mtime = goadb.MtimeOfClose
|
mtime = adb.MtimeOfClose
|
||||||
} else {
|
} else {
|
||||||
var err error
|
var err error
|
||||||
localFile, err = os.Open(localPath)
|
localFile, err = os.Open(localPath)
|
||||||
|
@ -203,7 +203,7 @@ func push(showProgress bool, localPath, remotePath string, device goadb.DeviceDe
|
||||||
}
|
}
|
||||||
defer localFile.Close()
|
defer localFile.Close()
|
||||||
|
|
||||||
client := goadb.NewDeviceClient(server, device)
|
client := adb.NewDeviceClient(server, device)
|
||||||
writer, err := client.OpenWrite(remotePath, perms, mtime)
|
writer, err := client.OpenWrite(remotePath, perms, mtime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "error opening remote file %s: %s\n", remotePath, err)
|
fmt.Fprintf(os.Stderr, "error opening remote file %s: %s\n", remotePath, err)
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
"github.com/zach-klippenstein/goadb/wire"
|
"github.com/zach-klippenstein/goadb/wire"
|
||||||
)
|
)
|
||||||
|
|
||||||
var port = flag.Int("p", goadb.AdbPort, "port the adb server is listening on")
|
var port = flag.Int("p", adb.AdbPort, "port the adb server is listening on")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
@ -49,7 +49,7 @@ func readLine() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func doCommand(cmd string) error {
|
func doCommand(cmd string) error {
|
||||||
server, err := goadb.NewServer(goadb.ServerConfig{
|
server, err := adb.NewServer(adb.ServerConfig{
|
||||||
Port: *port,
|
Port: *port,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// generated by stringer -type=deviceDescriptorType; DO NOT EDIT
|
// generated by stringer -type=deviceDescriptorType; DO NOT EDIT
|
||||||
|
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// generated by stringer -type=DeviceState; DO NOT EDIT
|
// generated by stringer -type=DeviceState; DO NOT EDIT
|
||||||
|
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
4
doc.go
4
doc.go
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Package goadb is a Go interface to the Android Debug Bridge (adb).
|
package adb is a Go interface to the Android Debug Bridge (adb).
|
||||||
|
|
||||||
See cmd/demo/demo.go for an example of how to use this library.
|
See cmd/demo/demo.go for an example of how to use this library.
|
||||||
|
|
||||||
|
@ -7,6 +7,6 @@ The client/server spec is defined at https://android.googlesource.com/platform/s
|
||||||
|
|
||||||
WARNING This library is under heavy development, and its API is likely to change without notice.
|
WARNING This library is under heavy development, and its API is likely to change without notice.
|
||||||
*/
|
*/
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
// TODO(z): Write method-specific examples.
|
// TODO(z): Write method-specific examples.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// TODO(z): Implement tests for sync_client functions.
|
// TODO(z): Implement tests for sync_client functions.
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package goadb
|
package adb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Package wire implements the low-level part of the client/server wire protocol.
|
Package wire implements the low-level part of the client/server wire protocol.
|
||||||
It also implements the "sync" wire format for file transfers.
|
It also implements the "sync" wire format for file transfers.
|
||||||
|
|
||||||
This package is not intended to be used directly. goadb.HostClient and goadb.DeviceClient
|
This package is not intended to be used directly. adb.HostClient and adb.DeviceClient
|
||||||
use it to abstract away the bit-twiddling details of the protocol. You should only ever
|
use it to abstract away the bit-twiddling details of the protocol. You should only ever
|
||||||
need to work with the goadb package. Also, this package's API may change more frequently
|
need to work with the goadb package. Also, this package's API may change more frequently
|
||||||
than goadb's.
|
than goadb's.
|
||||||
|
|
Loading…
Reference in a new issue