Refactor query reading from file, update docs

Add support for @file syntax in more places.
This commit is contained in:
Gordian Schoenherr
2024-12-13 12:48:38 +09:00
parent 005114839a
commit 9691b0f518
11 changed files with 101 additions and 56 deletions
+4 -3
View File
@@ -88,12 +88,11 @@ func aptlySnapshotPull(cmd *commander.Command, args []string) error {
// Initial queries out of arguments
queries := make([]deb.PackageQuery, len(args)-3)
for i, arg := range args[3:] {
var q string
q, err = getContent(arg)
value, err := GetStringOrFileContent(arg)
if err != nil {
return fmt.Errorf("unable to read package query from file %s: %w", arg, err)
}
queries[i], err = query.Parse(q)
queries[i], err = query.Parse(value)
if err != nil {
return fmt.Errorf("unable to parse query: %s", err)
}
@@ -172,6 +171,8 @@ versions from <source> following dependencies. New snapshot <destination>
is created as a result of this process. Packages could be specified simply
as 'package-name' or as package queries.
Use '@file' syntax to read package queries from file and '@-' to read from stdin.
Example:
$ aptly snapshot pull wheezy-main wheezy-backports wheezy-new-xorg xorg-server-server