| package main |
| |
| import ( |
| "regexp" |
| |
| "v.io/x/lib/cmdline" |
| "v.io/x/ref/cmd/sb/sb2/commands" |
| _ "v.io/x/ref/runtime/factories/generic" |
| ) |
| |
| func main() { |
| cmdline.HideGlobalFlagsExcept( |
| regexp.MustCompile("^service$"), |
| regexp.MustCompile("^blessing$"), |
| regexp.MustCompile("^db-name$"), |
| regexp.MustCompile("^create-if-absent$")) |
| cmdline.Main(cmdSb) |
| } |
| |
| var cmdSb = &cmdline.Command{ |
| Name: "sb2", |
| Short: "Vanadium syncbase client and management utility", |
| Long: ` |
| Syncbase general-purpose client and management utility. |
| Supports starting a syncQL shell and executing the commands at top level. |
| `, |
| Children: append([]*cmdline.Command{cmdSbShell}, commands.Commands...), |
| } |
| |
| var ( |
| flagCreateIfAbsent bool |
| flagService string |
| flagBlessing string |
| flagDBName string |
| ) |
| |
| func init() { |
| cmdSb.Flags.BoolVar(&flagCreateIfAbsent, "create-if-absent", false, "Create the target database if it doesn't exist.") |
| cmdSb.Flags.StringVar(&flagService, "service", "/:8081/syncbase", "Syncbase service to connect to.") |
| cmdSb.Flags.StringVar(&flagBlessing, "blessing", "dummy-blessing-name", "Blessing of db to connect to.") |
| cmdSb.Flags.StringVar(&flagDBName, "db-name", "dummy-db-name", "Name of db to connect to.") |
| } |