Пример #1
0
func run() int {
	flag.Usage = usage
	err := flags.ParseFlags()
	if err != nil {
		fmt.Println(err)
		usage()
		return -1
	}

	options := &parse.Options{
		Tag:        flags.Tag,
		Case:       flags.Case,
		AppendMode: flags.AppendMode,
		TagMode:    flags.TagMode,
		// this is confusing, I'll fix it later when changing documentation/flags behavior
		DryRun:  !flags.Write,
		Verbose: flags.Verbose}
	parse.SetOptions(options)
	err = parse.AndProcessFiles(flag.Args())
	if err != nil {
		fmt.Println(err)
		return -1
	}
	return 0
}
Пример #2
0
func run() int {
	flag.Usage = usage
	err := flags.ParseFlags()
	if err != nil {
		fmt.Println(err)
		return -1
	}

	err = parse.ParseAndProcess()
	if err != nil {
		fmt.Println(err)
		return -1
	}
	return 0
}