|
|
|
@ -8,6 +8,7 @@ import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
"net/http"
|
|
|
|
|
"sort"
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
"github.com/Bowery/prompt"
|
|
|
|
@ -27,19 +28,19 @@ type argT struct {
|
|
|
|
|
Credentials string `cli:"u,user" usage:"set basic auth credentials in form username:password"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const cliHelp = `
|
|
|
|
|
.help Show this message
|
|
|
|
|
.indexes Show names of all indexes
|
|
|
|
|
.schema Show CREATE statements for all tables
|
|
|
|
|
.status Show status and diagnostic information for connected node
|
|
|
|
|
.expvar Show expvar (Go runtime) information for connected node
|
|
|
|
|
.remove <raft ID> Remove a node from the cluster
|
|
|
|
|
.tables List names of tables
|
|
|
|
|
.timer on|off Turn query timer on or off
|
|
|
|
|
.dump <file> Dump the database in SQL text format to a file
|
|
|
|
|
.restore <file> Restore the database from a SQLite dump file
|
|
|
|
|
.backup <file> Write database backup to SQLite file
|
|
|
|
|
`
|
|
|
|
|
var cliHelp = []string{
|
|
|
|
|
`.backup <file> Write database backup to SQLite file`,
|
|
|
|
|
`.dump <file> Dump the database in SQL text format to a file`,
|
|
|
|
|
`.expvar Show expvar (Go runtime) information for connected node`,
|
|
|
|
|
`.help Show this message`,
|
|
|
|
|
`.indexes Show names of all indexes`,
|
|
|
|
|
`.restore <file> Restore the database from a SQLite dump file`,
|
|
|
|
|
`.schema Show CREATE statements for all tables`,
|
|
|
|
|
`.status Show status and diagnostic information for connected node`,
|
|
|
|
|
`.tables List names of tables`,
|
|
|
|
|
`.timer on|off Turn query timer on or off`,
|
|
|
|
|
`.remove <raft ID> Remove a node from the cluster`,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
cli.SetUsageStyle(cli.ManualStyle)
|
|
|
|
@ -155,7 +156,8 @@ func makeJSONBody(line string) string {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func help(ctx *cli.Context, cmd, line string, argv *argT) error {
|
|
|
|
|
fmt.Printf(cliHelp)
|
|
|
|
|
sort.Strings(cliHelp)
|
|
|
|
|
fmt.Printf(strings.Join(cliHelp, "\n"))
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|