From 40b707827c9bfc074d0fa007fd01de225d6bfa0f Mon Sep 17 00:00:00 2001 From: Timo Reichl Date: Sun, 8 Oct 2023 01:35:26 +0000 Subject: [PATCH] main/providers: List redacted provider info by default & add flag `--details` to show provider details Signed-off-by: Timo Reichl --- README.md | 38 +++++++++++++++++++++++++++++++++++++- main.go | 18 ++++++++++++++---- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fe28512..d6ec736 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ Simple tool to automatically download, convert, and install DEB packages on [Voi - [Using Go](#using-go) - [Manually](#manually) - [Listing available providers](#listing-available-providers) + - [With details redacted](#with-details-redacted) + - [With details (distributions and components)](#with-details-distributions-and-components) - [Managing package repositories](#managing-package-repositories) - [Syncing package repositories](#syncing-package-repositories) - [Supported package repositories](#supported-package-repositories) @@ -120,6 +122,7 @@ USAGE: xdeb-install providers [command options] [arguments...] OPTIONS: + --details display provider details (distributions and components) (default: false) --help, -h show help ``` @@ -227,11 +230,44 @@ Head over to the [releases](https://github.com/thetredev/xdeb-install/releases) ## Listing available providers -To check which providers are available, type: +### With details redacted + +To list available providers, type: ``` $ xdeb-install providers ``` +Output: +``` +[xdeb-install] Syncing lists: https://raw.githubusercontent.com/thetredev/xdeb-install-repositories/v1.1.1/repositories/x86_64/lists.yaml +debian.org + architecture: amd64 + url: http://ftp.debian.org/debian + +linuxmint.com + architecture: amd64 + url: http://packages.linuxmint.com + +ubuntu.com + architecture: amd64 + url: http://archive.ubuntu.com/ubuntu + +microsoft.com + architecture: amd64 + url: https://raw.githubusercontent.com/thetredev/xdeb-install-repositories/v1.1.1/repositories/x86_64/microsoft.com + +google.com + architecture: amd64 + url: https://raw.githubusercontent.com/thetredev/xdeb-install-repositories/v1.1.1/repositories/x86_64/google.com +``` + +### With details (distributions and components) + +To list available providers along with their distributions and components, type: +``` +$ xdeb-install providers --details +``` + Output: ``` [xdeb-install] Syncing lists: https://raw.githubusercontent.com/thetredev/xdeb-install-repositories/v1.1.1/repositories/x86_64/lists.yaml diff --git a/main.go b/main.go index bae9679..888c92b 100644 --- a/main.go +++ b/main.go @@ -262,6 +262,8 @@ func providers(context *cli.Context) error { return err } + showDetails := context.Bool("details") + for _, provider := range lists.Providers { fmt.Println(provider.Name) fmt.Printf(" architecture: %s\n", provider.Architecture) @@ -272,11 +274,13 @@ func providers(context *cli.Context) error { fmt.Printf(" url: %s\n", provider.Url) } - for _, distribution := range provider.Distributions { - fmt.Printf(" distribution: %s\n", distribution) + if showDetails { + for _, distribution := range provider.Distributions { + fmt.Printf(" distribution: %s\n", distribution) - for _, component := range provider.Components { - fmt.Printf(" component: %s\n", component) + for _, component := range provider.Components { + fmt.Printf(" component: %s\n", component) + } } } @@ -501,6 +505,12 @@ func main() { Usage: "list available providers", Aliases: []string{"p"}, Action: providers, + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "details", + Usage: "display provider details (distributions and components)", + }, + }, }, { Name: "sync",