Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
jreisinger committed May 13, 2023
1 parent a8ec0b4 commit 26ae3db
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ghrel [flags] <owner>/<repo>
-v be verbose
```

To use ghrel, download a [binary](https://github.com/jreisinger/ghrel/releases) for your system and architecture or if you have [Go installed](https://go.dev/doc/install):
To use ghrel download a [binary](https://github.com/jreisinger/ghrel/releases) for your system and architecture. Or, if you have [Go installed](https://go.dev/doc/install):

```
$ go install github.com/jreisinger/ghrel@latest
Expand Down
11 changes: 2 additions & 9 deletions asset/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,8 @@ func Download(a Asset) error {
return nil
}

// List prints a list of assets.
func List(assets []Asset) {
for _, a := range assets {
fmt.Println(a.Name)
}
}

// ListTable prints a list of assets in a table format with additional info.
func ListTable(assets []Asset) {
// Table prints a table of assets with additional info.
func Table(assets []Asset) {
const format = "%v\t%v\t%v\t%v\n"
tw := new(tabwriter.Writer).Init(os.Stdout, 0, 8, 2, ' ', 0)
fmt.Fprintf(tw, format, "Asset", "Updated", "Size", "Download count")
Expand Down
17 changes: 4 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ func main() {

if *l {
if *v {
asset.ListTable(assets)
asset.Table(assets)
} else {
asset.List(assets)
for _, a := range assets {
fmt.Println(a.Name)
}
}
os.Exit(0)
}
Expand Down Expand Up @@ -118,14 +120,3 @@ Asset:
fmt.Printf("verified\t%d\n", verifiedFiles)
}
}

func removeChecksumFiles(assets []asset.Asset) error {
for _, a := range assets {
if a.IsChecksumFile {
if err := os.Remove(a.Name); err != nil {
return err
}
}
}
return nil
}

0 comments on commit 26ae3db

Please sign in to comment.