Add option to specify the version code of an app
@ -39,6 +39,8 @@ Install an app:
uninstall <appid...> Uninstall an app
defaults Reset to the default settings
A specific version of an app can be selected by following the appid with an colon (:) and the version code of the app to select.
### Config
You can configure the repositories to use in the `config.json` file,
@ -140,6 +140,7 @@ func init() {
fmt.Fprintf(os.Stderr, " %s%s %s\n", c.UsageLine,
strings.Repeat(" ", maxUsageLen-len(c.UsageLine)), c.Short)
}
fmt.Fprintf(os.Stderr, "\nA specific version of an app can be selected by following the appid with an colon (:) and the version code of the app to select.\n")
fmt.Fprintf(os.Stderr, "\nUse %s <command> -h for more info\n", cmdName)
@ -7,6 +7,7 @@ import (
"fmt"
"log"
"os"
"strconv"
"strings"
"github.com/mvdan/fdroidcl"
@ -47,10 +48,34 @@ func findApps(ids []string) []*fdroidcl.App {
apps := appsMap(mustLoadIndexes())
result := make([]*fdroidcl.App, len(ids))
for i, id := range ids {
var vcode = -1
j := strings.Index(id, ":")
if j > -1 {
var err error
vcode, err = strconv.Atoi(id[j+1:])
if err != nil {
log.Fatalf("Could not parse version code from '%s'", id)
id = id[:j]
app, e := apps[id]
if !e {
log.Fatalf("Could not find app with ID '%s'", id)
if vcode > -1 {
found := false
for _, apk := range app.Apks {
if apk.VCode == vcode {
app.Apks = []fdroidcl.Apk{apk}
found = true
if !found {
log.Fatalf("Could not find version %d for app with ID '%s'", vcode, id)
result[i] = app
return result