Generalize to read filter from file or stdin.

This commit is contained in:
Christof Warlich authored and Gordian Schoenherr committed 2024-12-13 11:24:54 +09:00
1 parent a5d322252a
commit 005114839a
5 files changed
+55 -42

No files matched your search

+4 -1
View File
@@ -46,12 +46,15 @@ func aptlyMirrorCreate(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to create mirror: %s", err)
}
repo.Filter = context.Flags().Lookup("filter").Value.String()
repo.Filter, err = getContent(context.Flags().Lookup("filter").Value.String())
repo.FilterWithDeps = context.Flags().Lookup("filter-with-deps").Value.Get().(bool)
repo.SkipComponentCheck = context.Flags().Lookup("force-components").Value.Get().(bool)
repo.SkipArchitectureCheck = context.Flags().Lookup("force-architectures").Value.Get().(bool)
if repo.Filter != "" {
if err != nil {
return fmt.Errorf("unable to read package query from file %s: %w", context.Flags().Lookup("filter").Value.String(), err)
}
_, err = query.Parse(repo.Filter)
if err != nil {
return fmt.Errorf("unable to create mirror: %s", err)