Support for Go-style templating in format for aptly * search. #254

This commit is contained in:
Andrey Smirnov
2015-07-02 12:19:41 +03:00
parent 6c28e3aca8
commit 8bda799545
14 changed files with 16521 additions and 12 deletions
+4 -5
View File
@@ -2,7 +2,6 @@ package cmd
import (
"fmt"
"github.com/smira/aptly/deb"
"github.com/smira/aptly/query"
"github.com/smira/commander"
"github.com/smira/flag"
@@ -25,10 +24,8 @@ func aptlyPackageSearch(cmd *commander.Command, args []string) error {
return fmt.Errorf("no results")
}
result.ForEach(func(p *deb.Package) error {
context.Progress().Printf("%s\n", p)
return nil
})
format := context.Flags().Lookup("format").Value.String()
PrintPackageList(result, format)
return err
}
@@ -48,5 +45,7 @@ Example:
Flag: *flag.NewFlagSet("aptly-package-search", flag.ExitOnError),
}
cmd.Flag.String("format", "", "custom format for result printing")
return cmd
}