github.com/grailbio/base@v0.0.11/cmd/grail-file/main.go (about)

     1  package main
     2  
     3  import (
     4  	"context"
     5  	"flag"
     6  	"os"
     7  
     8  	"github.com/grailbio/base/cmd/grail-file/cmd"
     9  	"github.com/grailbio/base/file"
    10  	"github.com/grailbio/base/file/s3file"
    11  	"github.com/grailbio/base/log"
    12  )
    13  
    14  func main() {
    15  	help := flag.Bool("help", false, "Display help about this command")
    16  	flag.Parse()
    17  	if *help {
    18  		cmd.PrintHelp()
    19  		os.Exit(0)
    20  	}
    21  
    22  	log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds | log.Lshortfile)
    23  	file.RegisterImplementation("s3", func() file.Implementation {
    24  		return s3file.NewImplementation(s3file.NewDefaultProvider(), s3file.Options{})
    25  	})
    26  	err := cmd.Run(context.Background(), os.Args[1:])
    27  	if err != nil {
    28  		log.Fatal(err)
    29  	}
    30  }