Skip to content

Commit 9b8b4bd

Browse files
committed
refactoring
1 parent 56f530f commit 9b8b4bd

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

cmd/arduino_lib.go

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func executeDownloadCommand(cmd *cobra.Command, args []string) error {
119119
}
120120
}
121121

122-
status, err := libraries.CreateStatusContextFromIndex(index, nil, nil)
122+
status, err := libraries.CreateStatusContextFromIndex(index)
123123
if err != nil {
124124
status, err = prettyPrintCorruptedIndexFix(index)
125125
if err != nil {
@@ -173,7 +173,7 @@ func executeInstallCommand(cmd *cobra.Command, args []string) error {
173173
}
174174
}
175175

176-
status, err := libraries.CreateStatusContextFromIndex(index, nil, nil)
176+
status, err := libraries.CreateStatusContextFromIndex(index)
177177
if err != nil {
178178
status, err = prettyPrintCorruptedIndexFix(index)
179179
if err != nil {
@@ -332,29 +332,12 @@ func executeSearch(cmd *cobra.Command, args []string) error {
332332
return nil
333333
}
334334

335-
status, err := libraries.CreateStatusContextFromIndex(index, nil, nil)
335+
status, err := libraries.CreateStatusContextFromIndex(index)
336336
if err != nil {
337-
if GlobalFlags.Verbose > 0 {
338-
fmt.Println("Cannot parse index file, it may be corrupted. downloading from downloads.arduino.cc")
339-
}
340-
341-
err = prettyPrintDownloadFileIndex()
342-
if err != nil {
343-
return nil
344-
}
345-
346-
//after download, I retry.
347-
status, err = libraries.CreateStatusContextFromIndex(index, nil, nil)
337+
status, err = prettyPrintCorruptedIndexFix(index)
348338
if err != nil {
349-
if GlobalFlags.Verbose > 0 {
350-
fmt.Println("ERROR")
351-
}
352-
fmt.Println("Cannot parse downloaded index file")
353339
return nil
354340
}
355-
if GlobalFlags.Verbose > 0 {
356-
fmt.Println("OK")
357-
}
358341
}
359342

360343
found := false

libraries/status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func (l *StatusContext) Names() []string {
108108
}
109109

110110
// CreateStatusContextFromIndex creates a status context from index data.
111-
func CreateStatusContextFromIndex(index *Index, sketchbookPaths []string, corePaths []string) (*StatusContext, error) {
111+
func CreateStatusContextFromIndex(index *Index) (*StatusContext, error) {
112112
// Start with an empty status context
113113
libraries := StatusContext{
114114
Libraries: map[string]*Library{},

0 commit comments

Comments
 (0)