Skip to content

Commit c6bb5f7

Browse files
committed
cmd filter: add comment and cleanup
1 parent 50d3676 commit c6bb5f7

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

cmd/mirror_create.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,12 @@ func aptlyMirrorCreate(cmd *commander.Command, args []string) error {
4646
return fmt.Errorf("unable to create mirror: %s", err)
4747
}
4848

49-
repo.Filter = context.Flags().Lookup("filter").Value.String()
49+
repo.Filter = context.Flags().Lookup("filter").Value.String() // allows file/stdin with @
5050
repo.FilterWithDeps = context.Flags().Lookup("filter-with-deps").Value.Get().(bool)
5151
repo.SkipComponentCheck = context.Flags().Lookup("force-components").Value.Get().(bool)
5252
repo.SkipArchitectureCheck = context.Flags().Lookup("force-architectures").Value.Get().(bool)
5353

5454
if repo.Filter != "" {
55-
if err != nil {
56-
return fmt.Errorf("unable to read package query from file %s: %w", context.Flags().Lookup("filter").Value.String(), err)
57-
}
5855
_, err = query.Parse(repo.Filter)
5956
if err != nil {
6057
return fmt.Errorf("unable to create mirror: %s", err)

cmd/mirror_edit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func aptlyMirrorEdit(cmd *commander.Command, args []string) error {
3232
context.Flags().Visit(func(flag *flag.Flag) {
3333
switch flag.Name {
3434
case "filter":
35-
repo.Filter = flag.Value.String()
35+
repo.Filter = flag.Value.String() // allows file/stdin with @
3636
case "filter-with-deps":
3737
repo.FilterWithDeps = flag.Value.Get().(bool)
3838
case "with-installer":

0 commit comments

Comments
 (0)