Documentation ¶
Overview ¶
Command-line options and utilities used by multiple cmds.
Index ¶
- Constants
- Variables
- func CheckExecutableVersionMatches(path, appName, version string) error
- func FindDefaultMountRoot() string
- func FireHandlers(handlers []string, values map[string]string)
- func Initialize(appName string, baseConfig *BaseConfig)
- func NewMountpointForDevice(deviceInfo *adb.DeviceInfo, mountRoot, serial string) (mountpoint string, err error)
- func RegisterAdbfsFlags(config *AdbfsConfig)
- func RegisterAutomountFlags(config *AutomountConfig)
- type AdbfsConfig
- type AutomountConfig
- type BaseConfig
- type EventLog
- type Process
- type ProcessInfo
- type ProcessTracker
Constants ¶
const ( DeviceSerialFlag = "device" MountpointFlag = "mountpoint" )
const ( MountRootFlag = "root" PathToAdbfsFlag = "adbfs" AllowAnyAdbfsFlag = "disable-adbfs-verify" OnMountHandlerFlag = "on-mount" OnUnmountHandlerFlag = "on-unmount" )
const ( DefaultPoolSize = 2 DefaultCacheTtl = 300 * time.Millisecond DefaultLogLevel = logrus.InfoLevel )
const ( AdbPortFlag = "port" ConnectionPoolSizeFlag = "pool" CacheTtlFlag = "cachettl" LogLevelFlag = "log" VerboseFlag = "verbose" ServeDebugFlag = "debug" DeviceRootFlag = "device-root" ReadOnlyFlag = "readonly" PathToAdb = "adb" )
const ( PathHandlerVar = "ADBFS_PATH" SerialHandlerVar = "ADBFS_SERIAL" ModelHandlerVar = "ADBFS_MODEL" )
const MountpointPerm os.FileMode = 0700
Permissions for mountpoint directories.
const Version = "1.0.0"
Variables ¶
var Log *logrus.Logger = logrus.StandardLogger()
Functions ¶
func CheckExecutableVersionMatches ¶
CheckExecutableVersionMatches returns an error if running "$path --version" does not give output indicating that it is appName with version. If version is empty, ignores the version number as long as the appName matches.
func FindDefaultMountRoot ¶
func FindDefaultMountRoot() string
func FireHandlers ¶
FireHandlers executes each handler in handlers with all occurrences of $key or ${key} replaced with values[key]. The map keys should be the *HandlerVar constants.
func Initialize ¶
func Initialize(appName string, baseConfig *BaseConfig)
Initialize sets the app name. Must be called before flag.Parse()
func NewMountpointForDevice ¶
func RegisterAdbfsFlags ¶
func RegisterAdbfsFlags(config *AdbfsConfig)
func RegisterAutomountFlags ¶
func RegisterAutomountFlags(config *AutomountConfig)
Types ¶
type AdbfsConfig ¶
type AdbfsConfig struct { BaseConfig DeviceSerial string Mountpoint string }
func (*AdbfsConfig) AsArgs ¶
func (c *AdbfsConfig) AsArgs() []string
type AutomountConfig ¶
type AutomountConfig struct { BaseConfig MountRoot string PathToAdbfs string AllowAnyAdbfs bool OnMountHandlers []string OnUnmountHandlers []string }
func (*AutomountConfig) InitializePaths ¶
func (c *AutomountConfig) InitializePaths()
type BaseConfig ¶
type BaseConfig struct { // Command-line arguments. Each variable in this block should have a line in AsArgs(). AdbPort int ConnectionPoolSize int LogLevel string Verbose bool CacheTtl time.Duration ServeDebug bool DeviceRoot string ReadOnly bool PathToAdb string }
func (*BaseConfig) AsArgs ¶
func (c *BaseConfig) AsArgs() []string
AsArgs returns a string array suitable to be passed to exec.Command that copies the arguments defined in this package.
func (*BaseConfig) ServerConfig ¶
func (c *BaseConfig) ServerConfig() adb.ServerConfig
ServerConfig returns a adb.ServerConfig from CLI arguments.
type EventLog ¶
type EventLog struct {
// contains filtered or unexported fields
}
EventLog wraps trace.EventLog with logging calls to cli.Log.
func NewEventLog ¶
type ProcessInfo ¶
type ProcessInfo struct {
// contains filtered or unexported fields
}
type ProcessTracker ¶
type ProcessTracker struct {
// contains filtered or unexported fields
}
ProcessTracker manages multiple goroutines that are deduped by a key and are associated with a stop channel.
func NewProcessTracker ¶
func NewProcessTracker() *ProcessTracker
func (*ProcessTracker) Go ¶
func (t *ProcessTracker) Go(key string, proc Process) (procInfo *ProcessInfo, err error)
func (*ProcessTracker) Shutdown ¶
func (t *ProcessTracker) Shutdown()