Skip to content

Commit

Permalink
Filter assets inside Zip archives (#82)
Browse files Browse the repository at this point in the history
Relates to #79.

Signed-off-by: Sune Keller <sune.keller+gitlab.com@gmail.com>

Co-authored-by: Sune Keller <sune.keller+gitlab.com@gmail.com>
  • Loading branch information
sirlatrom and sirlatrom authored Mar 21, 2021
1 parent 058bb2e commit 060dc0d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/assets/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,15 @@ func processZip(name string, r io.Reader) (string, io.Reader, error) {
return "", nil, errors.New("No files found in zip archive")
}

generic := make([]fmt.Stringer, 0)
as := make([]*Asset, 0)
for f := range zipFiles {
generic = append(generic, options.LiteralStringer(f))
as = append(as, &Asset{Name: f, URL: ""})
}
choice, err := options.Select("Select file to extract:", generic)
choice, err := FilterAssets(name, as)
if err != nil {
return "", nil, err
}
selectedFile := choice.(fmt.Stringer).String()
selectedFile := choice.String()

fr := bytes.NewReader(zipFiles[selectedFile])

Expand Down

0 comments on commit 060dc0d

Please sign in to comment.