patchdef

package
v0.0.0-...-fad336a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package patchdef contains helpers for patching Android apps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteTemplate

func ExecuteTemplate(tmpl string, data any) string

func FixIndent

func FixIndent(s string) string

func PatchFile

func PatchFile(src string, pt ...StringPatcher) *patchInst

func PatchFiles

func PatchFiles(src []string, pt ...StringPatcher) *patchInst

func Register

func Register(name string, inst ...Instruction)

Types

type Instruction

type Instruction interface {
	Do(apk string, diffwriter io.Writer) error
}

func DefineR

func DefineR(path, typ, name string) Instruction

func DeleteFile

func DeleteFile(name string) Instruction

func WriteFile

func WriteFile(to string, content []byte) Instruction

func WriteFileString

func WriteFileString(to, content string) Instruction

type Patch

type Patch struct {
	// contains filtered or unexported fields
}

func Patches

func Patches() []*Patch

func (Patch) Apply

func (p Patch) Apply(apk string, diffwriter io.Writer) error

func (Patch) Name

func (p Patch) Name() string

func (Patch) String

func (p Patch) String() string

type StringPatcher

type StringPatcher interface {
	PatchString(string) (string, error)
}

func AppendString

func AppendString(s string) StringPatcher

func InConstant

func InConstant(constant string, pt StringPatcher) StringPatcher

func InMethod

func InMethod(method string, pt ...StringPatcher) StringPatcher

func MustContain

func MustContain(s string) StringPatcher

func ReplaceString

func ReplaceString(find, replace string) StringPatcher

func ReplaceStringAppend

func ReplaceStringAppend(find, replace string) StringPatcher

func ReplaceStringPrepend

func ReplaceStringPrepend(find, replace string) StringPatcher

func ReplaceStringRe

func ReplaceStringRe(find *regexp.Regexp, replace string) StringPatcher

func ReplaceStringReLiteral

func ReplaceStringReLiteral(find *regexp.Regexp, replace string) StringPatcher

func ReplaceWith

func ReplaceWith(s string) StringPatcher

type StringPatcherFunc

type StringPatcherFunc func(string) (string, error)

func (StringPatcherFunc) PatchString

func (fn StringPatcherFunc) PatchString(s string) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL