@@ -90,20 +90,20 @@ func ProcessOutput(input, xcmd string) {
90
90
// Variáveis para manter as informações do pacote
91
91
var packages []PackageInfo
92
92
var currentPackage PackageInfo
93
- isDescription := false
94
- isName := false
93
+ IsDescription := false
94
+ IsName := false
95
95
96
96
// Divide o texto de entrada em linhas
97
97
lines := strings .Split (input , "\n " )
98
98
99
99
// Processa cada linha da entrada
100
100
for _ , line := range lines {
101
101
// Verifica se a linha começa com 2 espaços iniciais (indica descrição)
102
- if strings .HasPrefix (line , " " ) {
102
+ if strings .HasPrefix (line , " " ) && IsName == true {
103
103
line = strings .TrimSpace (line )
104
104
currentPackage .Description += line
105
- isDescription = true
106
- } else {
105
+ IsDescription = true
106
+ } else if IsName == false {
107
107
// Divide a linha em campos e verifica se há pelo menos 2 campos (nome e versão)
108
108
fields := strings .Fields (line )
109
109
if len (fields ) >= 1 {
@@ -134,20 +134,15 @@ func ProcessOutput(input, xcmd string) {
134
134
currentPackage .Status = fields [2 ]
135
135
}
136
136
}
137
- isName = true
137
+ IsName = true
138
138
}
139
139
}
140
140
// Se a linha não começar com 2 espaços, isso indica o início de um novo pacote
141
- if isDescription == true && isName == true {
141
+ if IsDescription == true && IsName == true {
142
142
packages = append (packages , currentPackage )
143
143
currentPackage = PackageInfo {}
144
- isDescription = false
145
- isName = false
146
- } else if isName == true {
147
- packages = append (packages , currentPackage )
148
- currentPackage = PackageInfo {}
149
- isDescription = false
150
- isName = false
144
+ IsDescription = false
145
+ IsName = false
151
146
}
152
147
}
153
148
0 commit comments