Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
Print out arm support from remote sources
Browse files Browse the repository at this point in the history
  • Loading branch information
harryzcy committed Mar 28, 2021
1 parent 39f70de commit 41388bd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
// Table prints application information in table format
func Table(apps []macapp.Application) {
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Name", "Architectures"})
table.SetHeader([]string{"Name", "Current ßArchitectures", "Arm Support"})

for _, app := range apps {
table.Append([]string{app.Name, app.Architectures.String()})
table.Append([]string{app.Name, app.Architectures.String(), app.ArmSupport})
}

table.Render()
Expand Down
17 changes: 13 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,27 @@ import (

"github.com/harryzcy/ascheck/internal/macapp"
"github.com/harryzcy/ascheck/internal/output"
"github.com/harryzcy/ascheck/internal/remotecheck"
"github.com/urfave/cli/v2"
)

// handleErr prints error and calls os.Exit(1) if err is not nil.
func handleErr(err error) {
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}

func main() {
app := &cli.App{
Usage: "A cli app that check app's Apple Silicon support",
Action: func(c *cli.Context) error {
err := remotecheck.Init()
handleErr(err)

apps, err := macapp.GetAllApplications(nil)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
handleErr(err)

output.Table(apps)
return nil
Expand Down

0 comments on commit 41388bd

Please sign in to comment.