Skip to content

Commit

Permalink
main/providers: List redacted provider info by default & add flag `--…
Browse files Browse the repository at this point in the history
…details` to show provider details

Signed-off-by: Timo Reichl <thetredev@gmail.com>
  • Loading branch information
thetredev committed Oct 8, 2023
1 parent 97839a1 commit 40b7078
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 5 deletions.
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
```

Expand Down Expand Up @@ -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
Expand Down
18 changes: 14 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
}
}

Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 40b7078

Please sign in to comment.