1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
// Copyright 2021 Roxy Light
// SPDX-License-Identifier: ISC
package shell_test
import (
"fmt"
"os"
"zombiezen.com/go/sqlite"
"zombiezen.com/go/sqlite/shell"
)
// This is a small program that emulates the behavior of the sqlite3 CLI.
// A path to a database can be passed on the command-line.
func Example() {
dbName := ":memory:"
if len(os.Args) > 1 {
dbName = os.Args[1]
}
conn, err := sqlite.OpenConn(dbName)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
shell.Run(conn)
conn.Close()
}
|