Browse Source

Add support for enabling/disabling of repos

pull/8/head
Daniel Martí 11 years ago
parent
commit
5a2c9e2e60
  1. 15
      cmd/fdroidcl/main.go
  2. 6
      cmd/fdroidcl/update.go

15
cmd/fdroidcl/main.go

@ -48,8 +48,9 @@ func configPath() string {
}
type repo struct {
ID string `json:"id"`
URL string `json:"url"`
ID string `json:"id"`
URL string `json:"url"`
Enabled bool `json:"enabled"`
}
type userConfig struct {
@ -59,8 +60,14 @@ type userConfig struct {
var config = userConfig{
Repos: []repo{
{
ID: "f-droid",
URL: "https://f-droid.org/repo",
ID: "f-droid",
URL: "https://f-droid.org/repo",
Enabled: true,
},
{
ID: "f-droid-archive",
URL: "https://f-droid.org/archive",
Enabled: false,
},
},
}

6
cmd/fdroidcl/update.go

@ -30,6 +30,9 @@ func init() {
func runUpdate(args []string) {
for _, r := range config.Repos {
if !r.Enabled {
continue
}
if err := r.updateIndex(); err != nil {
log.Fatalf("Could not update index: %v", err)
}
@ -131,6 +134,9 @@ func indexPath(name string) string {
func mustLoadIndexes() []fdroidcl.App {
m := make(map[string]*fdroidcl.App)
for _, r := range config.Repos {
if !r.Enabled {
continue
}
index, err := r.loadIndex()
if err != nil {
log.Fatalf("Error while loading %s: %v", r.ID, err)

Loading…
Cancel
Save