Files
portmaster/updates/uptool/scan.go
2019-07-02 15:12:31 +02:00

36 lines
547 B
Go

package main
import (
"encoding/json"
"fmt"
"github.com/safing/portmaster/updates"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(scanCmd)
}
var scanCmd = &cobra.Command{
Use: "scan",
Short: "Scan the current directory and print the result",
RunE: scan,
}
func scan(cmd *cobra.Command, args []string) error {
latest, err := updates.ScanForLatest(".", true)
if err != nil {
return err
}
data, err := json.MarshalIndent(latest, "", " ")
if err != nil {
return err
}
fmt.Println(string(data))
return nil
}