mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-06-04 14:11:09 +00:00
🐛 Fix an issue in the script title retrieval from the first comment once more
This commit is contained in:
parent
28fa6e494f
commit
de7f598001
@ -31,17 +31,18 @@ func ReadScriptFile(path string) (script *Script, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var title string
|
var title string
|
||||||
|
var titleIsSet bool
|
||||||
code := content
|
code := content
|
||||||
|
|
||||||
var idx0 file.Idx
|
var idx0 file.Idx
|
||||||
for node, comments := range program.Comments {
|
for node, comments := range program.Comments {
|
||||||
if (idx0 > 0 && node.Idx0() > idx0) || len(comments) == 0 {
|
if (titleIsSet && node.Idx0() > idx0) || len(comments) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
idx0 = node.Idx0()
|
|
||||||
|
|
||||||
|
idx0 = node.Idx0()
|
||||||
title = comments[0].Text
|
title = comments[0].Text
|
||||||
break
|
titleIsSet = true
|
||||||
}
|
}
|
||||||
|
|
||||||
script = &Script{
|
script = &Script{
|
||||||
|
Loading…
Reference in New Issue
Block a user