Add -json flag to publish list|show

Signed-off-by: Joshua Colson <joshua.colson@gmail.com>
This commit is contained in:
Joshua Colson
2021-09-21 18:46:59 -07:00
committed by Lorenzo Bolla
parent 129eb8644d
commit 899ed92ebc
11 changed files with 302 additions and 52 deletions
-47
View File
@@ -109,52 +109,6 @@ func aptlyMirrorShowJson(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to show: %s", err)
}
// fmt.Printf("Name: %s\n", repo.Name)
// if repo.Status == deb.MirrorUpdating {
// fmt.Printf("Status: In Update (PID %d)\n", repo.WorkerPID)
// }
// fmt.Printf("Archive Root URL: %s\n", repo.ArchiveRoot)
// fmt.Printf("Distribution: %s\n", repo.Distribution)
// fmt.Printf("Components: %s\n", strings.Join(repo.Components, ", "))
// fmt.Printf("Architectures: %s\n", strings.Join(repo.Architectures, ", "))
// downloadSources := No
// if repo.DownloadSources {
// downloadSources = Yes
// }
// fmt.Printf("Download Sources: %s\n", downloadSources)
// downloadUdebs := No
// if repo.DownloadUdebs {
// downloadUdebs = Yes
// }
// fmt.Printf("Download .udebs: %s\n", downloadUdebs)
// if repo.Filter != "" {
// fmt.Printf("Filter: %s\n", repo.Filter)
// filterWithDeps := No
// if repo.FilterWithDeps {
// filterWithDeps = Yes
// }
// fmt.Printf("Filter With Deps: %s\n", filterWithDeps)
// }
// if repo.LastDownloadDate.IsZero() {
// fmt.Printf("Last update: never\n")
// } else {
// fmt.Printf("Last update: %s\n", repo.LastDownloadDate.Format("2006-01-02 15:04:05 MST"))
// fmt.Printf("Number of packages: %d\n", repo.NumPackages())
// }
// fmt.Printf("\nInformation from release file:\n")
// for _, k := range utils.StrMapSortedKeys(repo.Meta) {
// fmt.Printf("%s: %s\n", k, repo.Meta[k])
// }
// if withPackages {
// if repo.LastDownloadDate.IsZero() {
// fmt.Printf("Unable to show package list, mirror hasn't been downloaded yet.\n")
// } else {
// ListPackagesRefList(repo.RefList())
// }
// }
// include packages if requested
if withPackages {
if repo.RefList() != nil {
@@ -171,7 +125,6 @@ func aptlyMirrorShowJson(cmd *commander.Command, args []string) error {
}
}
// merge the repo object with the package list
var output []byte
if output, err = json.MarshalIndent(repo, "", " "); err == nil {
fmt.Println(string(output))