<commit_before>package main

import (
	"bufio"
	"errors"
	"fmt"
	"os"
	"strings"
	"time"

	"github.com/urfave/cli"
)

func main() {
	app := cli.NewApp()
	app.Name = "rubusy"
	app.Usage = "cron job schedule searcher"
	app.UsageText = "rubusy [-l line] [-fr from] [-p] [--line value] [--from value] [--plain] [file]"
	app.Version = "0.0.1"
	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:  "job, j",
			Usage: "specific job search of the input.",
		},
		cli.StringFlag{
			Name:  "from, fr",
			Usage: "specific schedule search from time formatted like 2006-01-02-15-04",
		},
		cli.BoolFlag{
			Name:  "plain, p",
			Usage: "only result is written to standard output.",
		},
	}
	app.Action = func(c *cli.Context) error {

		// TODO validation的なこと

		// 検索範囲
		t := time.Now()
		str := c.String("from")
		if str != "" {
			const layout = "2006-01-02-15-04"
			// TODO 時刻変換に失敗したらエラー
			t, _ = time.Parse(layout, str)
		}

		timeCondition := searchRange{
			from: t,
			to:   t.Add(time.Duration(24*365) * time.Hour),
		}

		plain := c.Bool("plain")
		if !plain {
			fmt.Println(timeCondition)
			fmt.Println("==============================================")
		}

		var jobs []CronJob
		// TODO ファイル名もJobも未指定の場合、エラー
		targetJob := c.String("line")
		if targetJob != "" {
			jobs = []CronJob{Parse(targetJob)}
		} else {
			fileName := c.Args().Get(0)
			var err error
			jobs, err = readCrontabFile(fileName)
			if err != nil {
				return cli.NewExitError("read crontab file failed", 1)
			}
		}

		if len(jobs) == 0 {<commit_msg>modify message<commit_after>package main

import (
	"bufio"
	"errors"
	"fmt"
	"os"
	"strings"
	"time"

	"github.com/urfave/cli"
)

func main() {
	app := cli.NewApp()
	app.Name = "rubusy"
	app.Usage = "cron job schedule searcher"
	app.UsageText = "rubusy [-l line] [-fr from] [-p] [--line value] [--from value] [--plain] [file]"
	app.Version = "0.0.1"
	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:  "job, j",
			Usage: "specific job search of the input.",
		},
		cli.StringFlag{
			Name:  "from, fr",
			Usage: "specific schedule search from time formatted like 2006-01-02-15-04",
		},
		cli.BoolFlag{
			Name:  "plain, p",
			Usage: "only result is written to standard output.",
		},
	}
	app.Action = func(c *cli.Context) error {

		// TODO validation的なこと

		// 検索範囲
		t := time.Now()
		str := c.String("from")
		if str != "" {
			const layout = "2006-01-02-15-04"
			// TODO 時刻変換に失敗したらエラー
			t, _ = time.Parse(layout, str)
		}

		timeCondition := searchRange{
			from: t,
			to:   t.Add(time.Duration(24*365) * time.Hour),
		}

		plain := c.Bool("plain")
		if !plain {
			fmt.Println(timeCondition)
			fmt.Println("==============================================")
		}

		var jobs []CronJob
		// TODO ファイル名もJobも未指定の場合、エラー
		targetJob := c.String("line")
		if targetJob != "" {
			jobs = []CronJob{Parse(targetJob)}
		} else {
			fileName := c.Args().Get(0)
			var err error
			jobs, err = readCrontabFile(fileName)
			if err != nil {
				return cli.NewExitError("error: read crontab file failed", 1)
			}
		}

		if len(jobs) == 0 {
{'fraction_non_alphanumeric': 0.19732550554468362, 'fraction_numerical': 0.0228310502283105, 'mean_word_length': 2.988296488946684, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1279358', 'n_tokens_mistral': 1415, 'n_tokens_neox': 1236, 'n_words': 282}