<commit_before>package main

import (
	"encoding/json"
	"flag"
	"github.com/Bpazy/wl520/welove"
	"github.com/bitly/go-simplejson"
	"github.com/ltt1987/alidayu"
	"io"
	"io/ioutil"
	"log"
	"os"
	"reflect"
	"strconv"
	"sync"
)

var w sync.WaitGroup

func main() {
	isServer := flag.Bool("s", false, "启动我们的家HTTP代理")
	path := flag.String("out", "wl520.json", "生成的配置文件路径")
	port := flag.String("port", ":8080", "我们的家Http代理端口号")
	allTask := flag.Bool("a", false, "完成所有我们的家互动任务")
	configPath := flag.String("c", "wl520.json", "配置文件位置")
	visitTimes := flag.Int("v", -1, "每日拜访次数")
	outputPath := flag.String("log", "welove.log", "日志路径")
	tree := flag.Bool("t", false, "完成爱情树任务")
	pet := flag.Bool("p", false, "完成宠物任务")
	buyItemId := flag.Int("buy", 0, "农场购买物品ID")
	coin := flag.Int("coin", -1, "农场被购买物品ID的价格上限(闭区间)")
	farmSign := flag.Bool("farm-sign", false, "农场签到")
	smsNotify := flag.Bool("sms-notify", false, "检查签到情况并发送短信")
	flag.Parse()

	welove.ServerRun(*path, *port, *isServer)    // 是否开启代理服务器
	love := initConfig(*outputPath, *configPath) // 读取配置文件

	log.Println("wl520 start.")
	goFunc(buyItem, love, *buyItemId, *coin, *buyItemId) // 购买指定物品
	goFunc(doAllTasks, love, *allTask)                   // 完成互动任务
	goFunc(doVisit, *visitTimes, love)                   // 拜访任务
	goFunc(doTreePost, love, *tree)                      // 爱情树任务
	goFunc(doPetTasks, love, *pet)                       // 宠物任务
	goFunc(doFarmSign, love, *farmSign)                  // 农场签到
	goFunc(doSmsNotify, love, *smsNotify)                // 检查签到情况并发送短信
	w.Wait()
	log.Println("wl520 end.")

}

func goFunc(f interface{}, args ...interface{}) {
	v := reflect.ValueOf(f)<commit_msg>extract commandline config<commit_after>package main

import (
	"encoding/json"
	"flag"
	"github.com/Bpazy/wl520/welove"
	"github.com/bitly/go-simplejson"
	"github.com/ltt1987/alidayu"
	"io"
	"io/ioutil"
	"log"
	"os"
	"reflect"
	"strconv"
	"sync"
)

var w sync.WaitGroup

var (
	isServer   *bool
	path       *string
	port       *string
	allTask    *bool
	configPath *string
	visitTimes *int
	outputPath *string
	tree       *bool
	pet        *bool
	buyItemId  *int
	coin       *int
	farmSign   *bool
	smsNotify  *bool
)

func init() {
	isServer = flag.Bool("s", false, "启动我们的家HTTP代理")
	path = flag.String("out", "wl520.json", "生成的配置文件路径")
	port = flag.String("port", ":8080", "我们的家Http代理端口号")
	allTask = flag.Bool("a", false, "完成所有我们的家互动任务")
	configPath = flag.String("c", "wl520.json", "配置文件位置")
	visitTimes = flag.Int("v", -1, "每日拜访次数")
	outputPath = flag.String("log", "welove.log", "日志路径")
	tree = flag.Bool("t", false, "完成爱情树任务")
	pet = flag.Bool("p", false, "完成宠物任务")
	buyItemId = flag.Int("buy", 0, "农场购买物品ID")
	coin = flag.Int("coin", -1, "农场被购买物品ID的价格上限(闭区间)")
	farmSign = flag.Bool("farm-sign", false, "农场签到")
	smsNotify = flag.Bool("sms-notify", false, "检查签到情况并发送短信")
	flag.Parse()
}

func main() {

	welove.ServerRun(*path, *port, *isServer)    // 是否开启代理服务器
	love := initConfig(*outputPath, *configPath) // 读取配置文件

	log.Println("wl520 start.")
	goFunc(buyItem, love, *buyItemId, *coin, *buyItemId) // 购买指定物品
	goFunc(doAllTasks, love, *allTask)                   // 完成互动任务
	goFunc(doVisit, *visitTimes, love)                   // 拜访任务
	goFunc(doTreePost, love, *tree)                      // 爱情树任务
	goFunc(doPetTasks, love, *pet)                       // 宠物任务
	goFunc(doFarmSign, love, *farmSign)                  // 农场签到
	goFunc(doSmsNotify, love, *smsNotify)                // 检查签到情况并发送短信
	w.Wait()
	log.Println("wl520 end.")

}

func goFunc(f interface{}, args ...interface{}) {
	v := reflect.ValueOf(f)
{'fraction_non_alphanumeric': 0.17774039809363612, 'fraction_numerical': 0.01457807681525091, 'mean_word_length': 3.2526817640047674, 'pattern_counts': {'":': 2, '<': 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': '25548', 'n_tokens_mistral': 1667, 'n_tokens_neox': 1674, 'n_words': 276}