@@ -21,12 +21,12 @@ func main() {
2121
2222 flag .Parse ()
2323
24- if len ( os . Args ) < 2 {
24+ if flag . NArg () != 1 {
2525 printUsage ()
2626 os .Exit (1 )
2727 }
2828
29- binlogFilename := os . Args [ 2 ]
29+ binlogFilename := flag . Arg ( 0 )
3030 dbDsn := os .Getenv ("DB_DSN" )
3131
3232 if dbDsn == "" {
@@ -51,17 +51,17 @@ func consumerChainFromArgs() parser.ConsumerChain {
5151 chain .CollectAsJson (os .Stdout , * prettyPrintJsonFlag )
5252 glog .V (1 ).Infof ("Pretty print JSON %s" , * prettyPrintJsonFlag )
5353
54- if includeTablesFlag != nil {
54+ if * includeTablesFlag != "" {
5555 includeTables := commaSeparatedListToArray (* includeTablesFlag )
5656
5757 chain .IncludeTables (includeTables ... )
5858 glog .V (1 ).Infof ("Including tables %v" , includeTables )
5959 }
6060
61- if includeSchemasFlag != nil {
61+ if * includeSchemasFlag != "" {
6262 includeSchemas := commaSeparatedListToArray (* includeSchemasFlag )
6363
64- chain .IncludeTables (includeSchemas ... )
64+ chain .IncludeSchemas (includeSchemas ... )
6565 glog .V (1 ).Infof ("Including schemas %v" , includeSchemas )
6666 }
6767
@@ -73,7 +73,7 @@ func printUsage() {
7373
7474 usage := "Parse a binlog file, dump JSON to stdout. Includes options to filter by schema and table.\n " +
7575 "Reads from information_schema database to find out the field names for a row event.\n \n " +
76- "Usage:\t %s binlog [options ...]\n \n " +
76+ "Usage:\t %s [options ...] binlog \n \n " +
7777 "Options are:\n \n "
7878
7979 fmt .Fprintf (os .Stderr , usage , binName )
0 commit comments