README update for Command function
1 files changed, 8 insertions(+), 38 deletions(-)

M README.md
M README.md +8 -38
@@ 95,39 95,6 @@ import (
 func main() {
 	// `db` is your database connection (*sql.DB)
 
-	var (
-		verbose, fakeIt   bool
-		direction, stopID string
-	)
-
-	mf := flag.NewFlagSet("migrate", flag.ContinueOnError)
-	mf.BoolVar(&verbose, "verbose", false, "verbose output")
-	mf.BoolVar(&fakeIt, "fake", false, "fake migrations")
-	mf.Usage = func() {
-        msg := fmt.Sprintf("usage: %s migrate [options...] [up | down] [migration ID]\n", os.Args[0])
-        fmt.Fprintf(flag.CommandLine.Output(), msg)
-        mf.PrintDefaults()
-	}
-
-	if os.Args[1] != "migrate" {
-		mf.Usage()
-		return fmt.Errorf("Unknown command: %s", os.Args[1])
-	}
-
-	mf.Parse(os.Args[2:])
-	args := mf.Args()
-
-	if len(args) > 0 {
-		direction = args[0]
-		if direction != "up" && direction != "down" {
-			return fmt.Errorf("Unknown migration direction: %s", direction)
-		}
-	}
-
-	if len(args) > 1 {
-		stopID = args[1]
-	}
-
 	// Custom functions should be watching for the context's Done() channel
 	migrations := []migrate.Migration{
 		migrate.FileMigration("0001_initial", "migrations/0001_initial.sql", "migrations/0001_initial_rollback.sql", 0),

          
@@ 145,12 112,15 @@ func main() {
 		},
 	}
 
-	ctx := context.Background()
-	engine := migrate.NewEngine(db, migrations, migrate.DOLLAR, verbose)
-	if direction == "down" {
-		return engine.Rollback(ctx, stopID)
+	if len(os.Args) > 0 {
+		if os.Args[1] != "migrate" {
+			err := migrate.Command(db, migrations, migrate.DOLLAR)
+			// handle err
+			os.Exit(0)
+		}
 	}
-	return engine.Migrate(ctx, stopID, fakeIt)
+
+	// rest of your main() code
 }
 
 ```