forked from 17-12-20-ll/googleplay
-
Notifications
You must be signed in to change notification settings - Fork 2
/
badging.go
42 lines (40 loc) · 968 Bytes
/
badging.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"flag"
"fmt"
"os"
"os/exec"
"strings"
)
func main() {
// f
var name string
flag.StringVar(&name, "f", "", "file")
// v
var verbose bool
flag.BoolVar(&verbose, "v", false, "verbose")
flag.Parse()
if name != "" {
cmd := exec.Command("aapt", "dump", "badging", name)
cmd.Stderr = os.Stderr
buf, err := cmd.Output()
if err != nil {
panic(err)
}
lines := strings.FieldsFunc(string(buf), func(r rune) bool {
return r == '\n'
})
for _, line := range lines {
if verbose ||
strings.HasPrefix(line, " uses-feature:") ||
strings.HasPrefix(line, " uses-gl-es:") ||
strings.HasPrefix(line, "native-code:") ||
strings.HasPrefix(line, "uses-library-not-required:") ||
strings.HasPrefix(line, "uses-library:") {
fmt.Println(line)
}
}
} else {
flag.Usage()
}
}