Added flag to "get" subcommand to configure venture freshness limit

main
diff 2020-11-13 05:45:01 +00:00
parent 7f1f3520ec
commit f21d4fc496
1 changed files with 5 additions and 2 deletions

View File

@ -36,8 +36,11 @@ func main() {
// GetVenture collects all recent ventures from all users on the system.
// Any errors that occur while pulling individual ventures are silently ignored
func GetVenture(args []string) error {
// Set the expiration date for ventures at 2 weeks.
freshLimit := time.Now().AddDate(0, 0, -14)
getFlags := flag.NewFlagSet(os.Args[0]+" get", flag.ExitOnError)
freshDays := getFlags.Int("freshness", 14, "get all ventures newer than this number of days")
getFlags.Parse(args)
freshLimit := time.Now().AddDate(0, 0, *freshDays*-1)
allVenturePaths, err := filepath.Glob("/home/*/.venture")
if err != nil {