+ getOption := func(name string) []string {
+ data := GetOption(name)
+ if strs, ok := data.([]string); ok {
+ return strs
+ }
+ if ifs, ok := data.([]interface{}); ok {
+ result := make([]string, len(ifs))
+ for i, urlIf := range ifs {
+ if url, ok := urlIf.(string); ok {
+ result[i] = url
+ } else {
+ return nil
+ }
+ }
+ return result
+ }
+ return nil
+ }
+
+ channels := PluginChannels{}
+ for _, url := range getOption("pluginchannels") {
+ channels = append(channels, PluginChannel(url))
+ }
+ repos := []PluginRepository{}
+ for _, url := range getOption("pluginrepos") {
+ repos = append(repos, PluginRepository(url))
+ }
+ allPluginPackages = fetchAllSources(len(repos)+1, func(i int) PluginPackages {
+ if i == 0 {
+ return channels.Fetch()
+ }
+ return repos[i-1].Fetch()
+ })