Skip to content

Commit

Permalink
cmd filter: add comment and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
neolynx committed Dec 21, 2024
1 parent 50d3676 commit c6bb5f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions cmd/mirror_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,12 @@ 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 = context.Flags().Lookup("filter").Value.String() // allows file/stdin with @
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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/mirror_edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func aptlyMirrorEdit(cmd *commander.Command, args []string) error {
context.Flags().Visit(func(flag *flag.Flag) {
switch flag.Name {
case "filter":
repo.Filter = flag.Value.String()
repo.Filter = flag.Value.String() // allows file/stdin with @
case "filter-with-deps":
repo.FilterWithDeps = flag.Value.Get().(bool)
case "with-installer":
Expand Down

0 comments on commit c6bb5f7

Please sign in to comment.