Further work; tidying up, begin cmdline tool
This commit is contained in:
parent
2a25d80249
commit
5c05a75fba
5 changed files with 180 additions and 55 deletions
|
|
@ -1,12 +1,35 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/lwithers/htpack/internal/packed"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var inspectCmd = &cobra.Command{
|
||||
Use: "inspect",
|
||||
Short: "View contents of an htpack file",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if len(args) == 0 {
|
||||
return errors.New("must specify one or more files")
|
||||
}
|
||||
|
||||
var exitCode int
|
||||
for _, filename := range args {
|
||||
if err := Inspect(filename); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%s: %v\n",
|
||||
filename, err)
|
||||
exitCode = 1
|
||||
}
|
||||
}
|
||||
os.Exit(exitCode)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
// Inspect a packfile.
|
||||
// TODO: verify etag; verify integrity of compressed data.
|
||||
// TODO: skip Gzip/Brotli if not present; print ratio.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue