This repository has been archived on 2023-11-08. You can view files and clone it, but cannot push or open issues/pull-requests.
imp/main.go

31 lines
631 B
Go

package main
import (
"flag"
"fmt"
"os"
)
var Version = "develop"
func main() {
fs := flag.NewFlagSet("imp", flag.ExitOnError)
writeFlag := fs.Bool("write", false, "Write the re-ordered imports instead of just printing them")
fs.BoolVar(writeFlag, "w", *writeFlag, "--write")
ignoreFlag := fs.String("ignore", ".impignore", "Path to .impignore file")
fs.StringVar(ignoreFlag, "i", *ignoreFlag, "--ignore")
if err := fs.Parse(os.Args[1:]); err != nil {
fmt.Println(err)
}
root := "."
if fs.NArg() > 0 {
root = fs.Arg(0)
}
if err := runImp(root, *ignoreFlag, *writeFlag); err != nil {
fmt.Println(err)
}
}