github.phpd.cn/thought-machine/please@v12.2.0+incompatible/tools/jarcat/unzip_main.go (about)

     1  // Package main implements an extremely cut-down version of jarcat
     2  // which is used to break a circular dependency; jarcat depends on
     3  // several third-party libraries, and we use the jarcat tool to extract them.
     4  //
     5  // This implements just the unzip logic from it to get around that.
     6  // Obviously this only has impact on the plz repo itself, it's not a
     7  // consideration in normal use.
     8  package main
     9  
    10  import (
    11  	"fmt"
    12  	"os"
    13  
    14  	"tools/jarcat/unzip"
    15  )
    16  
    17  func main() {
    18  	if len(os.Args) != 3 || os.Args[1] != "x" {
    19  		fmt.Fprintf(os.Stderr, "Usage: jarcat_unzip x <zipfile>\n")
    20  		os.Exit(1)
    21  	}
    22  	if err := unzip.Extract(os.Args[2], ".", "", ""); err != nil {
    23  		fmt.Fprintf(os.Stderr, "Failed to extract: %s\n", err)
    24  		os.Exit(1)
    25  	}
    26  }