Commit a0b51aa6 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c38ab95d
...@@ -36,7 +36,7 @@ func fsDump(w io.Writer, path string, ntxn int) (err error) { ...@@ -36,7 +36,7 @@ func fsDump(w io.Writer, path string, ntxn int) (err error) {
// path & fsdump on error context // path & fsdump on error context
defer func() { defer func() {
if err != nil { if err != nil {
err = fmt.Errorf("%s: fsdump: %v", err) err = fmt.Errorf("%s: fsdump: %v", path, err)
} }
}() }()
...@@ -116,8 +116,12 @@ func fsDump(w io.Writer, path string, ntxn int) (err error) { ...@@ -116,8 +116,12 @@ func fsDump(w io.Writer, path string, ntxn int) (err error) {
return err return err
} }
func usage() {
fmt.Fprintf(os.Stderr, func main() {
ntxn := 10
usage := func() {
fmt.Fprintf(os.Stderr,
`fstail [options] <storage> `fstail [options] <storage>
Dump transactions from a FileStorage in reverse order Dump transactions from a FileStorage in reverse order
...@@ -127,11 +131,10 @@ Dump transactions from a FileStorage in reverse order ...@@ -127,11 +131,10 @@ Dump transactions from a FileStorage in reverse order
-h --help this help text. -h --help this help text.
-n <N> output the last <N> transactions (default %d). -n <N> output the last <N> transactions (default %d).
`) `, ntxn)
} }
func main() { flag.Usage = usage
ntxn := 10
flag.IntVar(&ntxn, "n", ntxn, "output the last <N> transactions") flag.IntVar(&ntxn, "n", ntxn, "output the last <N> transactions")
flag.Parse() flag.Parse()
...@@ -142,7 +145,7 @@ func main() { ...@@ -142,7 +145,7 @@ func main() {
} }
storPath := argv[0] storPath := argv[0]
err := fsDump(os.Stdout, storPath, n) err := fsDump(os.Stdout, storPath, ntxn)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment