Permalink
Browse files

Update deps: renamed skeema/mycli to skeema/mybase

No change in functionality.
  • Loading branch information...
evanelias committed Mar 20, 2017
1 parent f1b1031 commit 4cf282e8b8e1d95bcad8fed14072f6dd25f86069
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -5,7 +5,7 @@ import (
"strings"
log "github.com/Sirupsen/logrus"
- "github.com/skeema/mycli"
+ "github.com/skeema/mybase"
)
func init() {
@@ -17,17 +17,17 @@ could be used to define a "staging" or "development" environment pointing at a d
host and port, or perhaps a "local" environment pointing at localhost and a
socket path.`
- cmd := mycli.NewCommand("add-environment", summary, desc, AddEnvHandler)
- cmd.AddOption(mycli.StringOption("host", 'h', "", "Database hostname or IP address"))
- cmd.AddOption(mycli.StringOption("port", 'P', "3306", "Port to use for database host"))
- cmd.AddOption(mycli.StringOption("socket", 'S', "/tmp/mysql.sock", "Absolute path to Unix socket file used if host is localhost"))
- cmd.AddOption(mycli.StringOption("dir", 'd', ".", "Base dir for this host's schemas"))
+ cmd := mybase.NewCommand("add-environment", summary, desc, AddEnvHandler)
+ cmd.AddOption(mybase.StringOption("host", 'h', "", "Database hostname or IP address"))
+ cmd.AddOption(mybase.StringOption("port", 'P', "3306", "Port to use for database host"))
+ cmd.AddOption(mybase.StringOption("socket", 'S', "/tmp/mysql.sock", "Absolute path to Unix socket file used if host is localhost"))
+ cmd.AddOption(mybase.StringOption("dir", 'd', ".", "Base dir for this host's schemas"))
cmd.AddArg("environment", "", true)
CommandSuite.AddSubCommand(cmd)
}
// AddEnvHandler is the handler method for `skeema add-environment`
-func AddEnvHandler(cfg *mycli.Config) error {
+func AddEnvHandler(cfg *mybase.Config) error {
AddGlobalConfigFiles(cfg)
dir, err := NewDir(cfg.Get("dir"), cfg)
View
@@ -1,7 +1,7 @@
package main
import (
- "github.com/skeema/mycli"
+ "github.com/skeema/mybase"
)
func init() {
@@ -23,14 +23,14 @@ The ` + "`" + `skeema diff` + "`" + ` command is equivalent to ` + "`" + `skeema
An exit code of 0 will be returned if no differences were found, 1 if some
differences were found, or 2+ if an error occurred.`
- cmd := mycli.NewCommand("diff", summary, desc, DiffHandler)
+ cmd := mybase.NewCommand("diff", summary, desc, DiffHandler)
cmd.AddArg("environment", "production", false)
CommandSuite.AddSubCommand(cmd)
clonePushOptionsToDiff()
}
// DiffHandler is the handler method for `skeema diff`
-func DiffHandler(cfg *mycli.Config) error {
+func DiffHandler(cfg *mybase.Config) error {
// We just delegate to PushHandler, forcing dry-run to be enabled and always
// using concurrency of 1
cfg.CLI.OptionValues["dry-run"] = "1"
View
@@ -8,7 +8,7 @@ import (
"strings"
log "github.com/Sirupsen/logrus"
- "github.com/skeema/mycli"
+ "github.com/skeema/mybase"
"github.com/skeema/tengo"
)
@@ -27,19 +27,19 @@ For example, running ` + "`" + `skeema init staging` + "`" + ` will add config d
default is "production", so directives will be written to the [production]
section of the file.`
- cmd := mycli.NewCommand("init", summary, desc, InitHandler)
- cmd.AddOption(mycli.StringOption("host", 'h', "", "Database hostname or IP address"))
- cmd.AddOption(mycli.StringOption("port", 'P', "3306", "Port to use for database host"))
- cmd.AddOption(mycli.StringOption("socket", 'S', "/tmp/mysql.sock", "Absolute path to Unix socket file used if host is localhost"))
- cmd.AddOption(mycli.StringOption("dir", 'd', "<hostname>", "Base dir to use for this host's schemas"))
- cmd.AddOption(mycli.StringOption("schema", 0, "", "Only import the one specified schema; skip creation of subdirs for each schema"))
- cmd.AddOption(mycli.BoolOption("include-auto-inc", 0, false, "Include starting auto-inc values in table files"))
+ cmd := mybase.NewCommand("init", summary, desc, InitHandler)
+ cmd.AddOption(mybase.StringOption("host", 'h', "", "Database hostname or IP address"))
+ cmd.AddOption(mybase.StringOption("port", 'P', "3306", "Port to use for database host"))
+ cmd.AddOption(mybase.StringOption("socket", 'S', "/tmp/mysql.sock", "Absolute path to Unix socket file used if host is localhost"))
+ cmd.AddOption(mybase.StringOption("dir", 'd', "<hostname>", "Base dir to use for this host's schemas"))
+ cmd.AddOption(mybase.StringOption("schema", 0, "", "Only import the one specified schema; skip creation of subdirs for each schema"))
+ cmd.AddOption(mybase.BoolOption("include-auto-inc", 0, false, "Include starting auto-inc values in table files"))
cmd.AddArg("environment", "production", false)
CommandSuite.AddSubCommand(cmd)
}
// InitHandler is the handler method for `skeema init`
-func InitHandler(cfg *mycli.Config) error {
+func InitHandler(cfg *mybase.Config) error {
AddGlobalConfigFiles(cfg)
// Ordinarily, we use a dir structure of: host_dir/schema_name/*.sql
@@ -111,7 +111,7 @@ func InitHandler(cfg *mycli.Config) error {
}
// Figure out what needs to go in the hostDir's .skeema file.
- hostOptionFile := mycli.NewFile(hostDir.Path, ".skeema")
+ hostOptionFile := mybase.NewFile(hostDir.Path, ".skeema")
hostOptionFile.SetOptionValue(environment, "host", inst.Host)
if inst.Host == "localhost" && inst.SocketPath != "" {
hostOptionFile.SetOptionValue(environment, "socket", inst.SocketPath)
@@ -178,7 +178,7 @@ func PopulateSchemaDir(s *tengo.Schema, parentDir *Dir, makeSubdir bool) error {
// Put a .skeema file with the schema name in it. This is placed outside of
// any named section/environment since the default assumption is that schema
// names match between environments.
- optionFile := mycli.NewFile(".skeema")
+ optionFile := mybase.NewFile(".skeema")
optionFile.SetOptionValue("", "schema", s.Name)
if overridesCharSet, overridesCollation, err := s.OverridesServerCharSet(); err == nil {
if overridesCharSet {
View
@@ -5,7 +5,7 @@ import (
"os"
log "github.com/Sirupsen/logrus"
- "github.com/skeema/mycli"
+ "github.com/skeema/mybase"
)
func init() {
@@ -28,13 +28,13 @@ An exit code of 0 will be returned if all files were already formatted properly,
1 if some files were reformatted but all SQL was valid, or 2+ if at least one
file had SQL syntax errors or some other error occurred.`
- cmd := mycli.NewCommand("lint", summary, desc, LintHandler)
+ cmd := mybase.NewCommand("lint", summary, desc, LintHandler)
cmd.AddArg("environment", "production", false)
CommandSuite.AddSubCommand(cmd)
}
// LintHandler is the handler method for `skeema lint`
-func LintHandler(cfg *mycli.Config) error {
+func LintHandler(cfg *mybase.Config) error {
AddGlobalConfigFiles(cfg)
dir, err := NewDir(".", cfg)
if err != nil {
View
@@ -5,7 +5,7 @@ import (
"os"
log "github.com/Sirupsen/logrus"
- "github.com/skeema/mycli"
+ "github.com/skeema/mybase"
"github.com/skeema/tengo"
)
@@ -23,15 +23,15 @@ running ` + "`" + `skeema pull staging` + "`" + ` will apply config directives f
top of the file. If no environment name is supplied, the default is
"production".`
- cmd := mycli.NewCommand("pull", summary, desc, PullHandler)
- cmd.AddOption(mycli.BoolOption("include-auto-inc", 0, false, "Include starting auto-inc values in new table files, and update in existing files"))
- cmd.AddOption(mycli.BoolOption("normalize", 0, true, "Reformat *.sql files to match SHOW CREATE TABLE"))
+ cmd := mybase.NewCommand("pull", summary, desc, PullHandler)
+ cmd.AddOption(mybase.BoolOption("include-auto-inc", 0, false, "Include starting auto-inc values in new table files, and update in existing files"))
+ cmd.AddOption(mybase.BoolOption("normalize", 0, true, "Reformat *.sql files to match SHOW CREATE TABLE"))
cmd.AddArg("environment", "production", false)
CommandSuite.AddSubCommand(cmd)
}
// PullHandler is the handler method for `skeema pull`
-func PullHandler(cfg *mycli.Config) error {
+func PullHandler(cfg *mybase.Config) error {
AddGlobalConfigFiles(cfg)
dir, err := NewDir(".", cfg)
if err != nil {
View
@@ -6,7 +6,7 @@ import (
"sync"
log "github.com/Sirupsen/logrus"
- "github.com/skeema/mycli"
+ "github.com/skeema/mybase"
"github.com/skeema/tengo"
)
@@ -24,19 +24,19 @@ running ` + "`" + `skeema push staging` + "`" + ` will apply config directives f
top of the file. If no environment name is supplied, the default is
"production".`
- cmd := mycli.NewCommand("push", summary, desc, PushHandler)
- cmd.AddOption(mycli.BoolOption("verify", 0, true, "Test all generated ALTER statements on temp schema to verify correctness"))
- cmd.AddOption(mycli.BoolOption("allow-unsafe", 0, false, "Permit running ALTER or DROP operations that are potentially destructive"))
- cmd.AddOption(mycli.BoolOption("dry-run", 0, false, "Output DDL but don't run it; equivalent to `skeema diff`"))
- cmd.AddOption(mycli.BoolOption("first-only", '1', false, "For dirs mapping to multiple instances or schemas, just run against the first per dir"))
- cmd.AddOption(mycli.BoolOption("brief", 'q', false, "<overridden by diff command>").Hidden())
- cmd.AddOption(mycli.StringOption("alter-wrapper", 'x', "", "External bin to shell out to for ALTER TABLE; see manual for template vars"))
- cmd.AddOption(mycli.StringOption("alter-wrapper-min-size", 0, "0", "Ignore --alter-wrapper for tables smaller than this size in bytes"))
- cmd.AddOption(mycli.StringOption("alter-lock", 0, "", `Apply a LOCK clause to all ALTER TABLEs (valid values: "NONE", "SHARED", "EXCLUSIVE")`))
- cmd.AddOption(mycli.StringOption("alter-algorithm", 0, "", `Apply an ALGORITHM clause to all ALTER TABLEs (valid values: "INPLACE", "COPY")`))
- cmd.AddOption(mycli.StringOption("ddl-wrapper", 'X', "", "Like --alter-wrapper, but applies to all DDL types (CREATE, DROP, ALTER)"))
- cmd.AddOption(mycli.StringOption("safe-below-size", 0, "0", "Always permit destructive operations for tables below this size in bytes"))
- cmd.AddOption(mycli.StringOption("concurrent-instances", 'c', "1", "Perform operations on this number of instances concurrently"))
+ cmd := mybase.NewCommand("push", summary, desc, PushHandler)
+ cmd.AddOption(mybase.BoolOption("verify", 0, true, "Test all generated ALTER statements on temp schema to verify correctness"))
+ cmd.AddOption(mybase.BoolOption("allow-unsafe", 0, false, "Permit running ALTER or DROP operations that are potentially destructive"))
+ cmd.AddOption(mybase.BoolOption("dry-run", 0, false, "Output DDL but don't run it; equivalent to `skeema diff`"))
+ cmd.AddOption(mybase.BoolOption("first-only", '1', false, "For dirs mapping to multiple instances or schemas, just run against the first per dir"))
+ cmd.AddOption(mybase.BoolOption("brief", 'q', false, "<overridden by diff command>").Hidden())
+ cmd.AddOption(mybase.StringOption("alter-wrapper", 'x', "", "External bin to shell out to for ALTER TABLE; see manual for template vars"))
+ cmd.AddOption(mybase.StringOption("alter-wrapper-min-size", 0, "0", "Ignore --alter-wrapper for tables smaller than this size in bytes"))
+ cmd.AddOption(mybase.StringOption("alter-lock", 0, "", `Apply a LOCK clause to all ALTER TABLEs (valid values: "NONE", "SHARED", "EXCLUSIVE")`))
+ cmd.AddOption(mybase.StringOption("alter-algorithm", 0, "", `Apply an ALGORITHM clause to all ALTER TABLEs (valid values: "INPLACE", "COPY")`))
+ cmd.AddOption(mybase.StringOption("ddl-wrapper", 'X', "", "Like --alter-wrapper, but applies to all DDL types (CREATE, DROP, ALTER)"))
+ cmd.AddOption(mybase.StringOption("safe-below-size", 0, "0", "Always permit destructive operations for tables below this size in bytes"))
+ cmd.AddOption(mybase.StringOption("concurrent-instances", 'c', "1", "Perform operations on this number of instances concurrently"))
cmd.AddArg("environment", "production", false)
CommandSuite.AddSubCommand(cmd)
clonePushOptionsToDiff()
@@ -59,7 +59,7 @@ type sharedPushState struct {
}
// PushHandler is the handler method for `skeema push`
-func PushHandler(cfg *mycli.Config) error {
+func PushHandler(cfg *mybase.Config) error {
AddGlobalConfigFiles(cfg)
dir, err := NewDir(".", cfg)
if err != nil {
View
@@ -11,46 +11,46 @@ import (
"syscall"
log "github.com/Sirupsen/logrus"
- "github.com/skeema/mycli"
+ "github.com/skeema/mybase"
"golang.org/x/crypto/ssh/terminal"
)
// This file contains misc functions relating to configuration or option
// handling.
-// AddGlobalOptions adds Skeema global options to the supplied mycli.Command.
+// AddGlobalOptions adds Skeema global options to the supplied mybase.Command.
// Typically cmd should be the top-level Command / Command Suite.
-func AddGlobalOptions(cmd *mycli.Command) {
+func AddGlobalOptions(cmd *mybase.Command) {
// Options typically only found in .skeema files -- all hidden by default
- cmd.AddOption(mycli.StringOption("host", 0, "", "Database hostname or IP address").Hidden())
- cmd.AddOption(mycli.StringOption("port", 0, "3306", "Port to use for database host").Hidden())
- cmd.AddOption(mycli.StringOption("socket", 'S', "/tmp/mysql.sock", "Absolute path to Unix socket file used if host is localhost").Hidden())
- cmd.AddOption(mycli.StringOption("schema", 0, "", "Database schema name").Hidden())
- cmd.AddOption(mycli.StringOption("default-character-set", 0, "", "Schema-level default character set").Hidden())
- cmd.AddOption(mycli.StringOption("default-collation", 0, "", "Schema-level default collation").Hidden())
+ cmd.AddOption(mybase.StringOption("host", 0, "", "Database hostname or IP address").Hidden())
+ cmd.AddOption(mybase.StringOption("port", 0, "3306", "Port to use for database host").Hidden())
+ cmd.AddOption(mybase.StringOption("socket", 'S', "/tmp/mysql.sock", "Absolute path to Unix socket file used if host is localhost").Hidden())
+ cmd.AddOption(mybase.StringOption("schema", 0, "", "Database schema name").Hidden())
+ cmd.AddOption(mybase.StringOption("default-character-set", 0, "", "Schema-level default character set").Hidden())
+ cmd.AddOption(mybase.StringOption("default-collation", 0, "", "Schema-level default collation").Hidden())
// Visible global options
- cmd.AddOption(mycli.StringOption("user", 'u', "root", "Username to connect to database host"))
- cmd.AddOption(mycli.StringOption("password", 'p', "<no password>", "Password for database user; supply with no value to prompt").ValueOptional())
- cmd.AddOption(mycli.StringOption("host-wrapper", 'H', "", "External bin to shell out to for host lookup; see manual for template vars"))
- cmd.AddOption(mycli.StringOption("temp-schema", 't', "_skeema_tmp", "Name of temporary schema for intermediate operations, created and dropped each run unless --reuse-temp-schema"))
- cmd.AddOption(mycli.StringOption("connect-options", 'o', "", "Comma-separated session options to set upon connecting to each database instance"))
- cmd.AddOption(mycli.BoolOption("reuse-temp-schema", 0, false, "Do not drop temp-schema when done"))
- cmd.AddOption(mycli.BoolOption("debug", 0, false, "Enable debug logging"))
+ cmd.AddOption(mybase.StringOption("user", 'u', "root", "Username to connect to database host"))
+ cmd.AddOption(mybase.StringOption("password", 'p', "<no password>", "Password for database user; supply with no value to prompt").ValueOptional())
+ cmd.AddOption(mybase.StringOption("host-wrapper", 'H', "", "External bin to shell out to for host lookup; see manual for template vars"))
+ cmd.AddOption(mybase.StringOption("temp-schema", 't', "_skeema_tmp", "Name of temporary schema for intermediate operations, created and dropped each run unless --reuse-temp-schema"))
+ cmd.AddOption(mybase.StringOption("connect-options", 'o', "", "Comma-separated session options to set upon connecting to each database instance"))
+ cmd.AddOption(mybase.BoolOption("reuse-temp-schema", 0, false, "Do not drop temp-schema when done"))
+ cmd.AddOption(mybase.BoolOption("debug", 0, false, "Enable debug logging"))
}
-// AddGlobalConfigFiles takes the mycli.Config generated from the CLI and adds
+// AddGlobalConfigFiles takes the mybase.Config generated from the CLI and adds
// global option files as sources. It also handles special processing for a few
// options. Generally, subcommand handlers should call AddGlobalConfigFiles at
// the top of the method.
-func AddGlobalConfigFiles(cfg *mycli.Config) {
+func AddGlobalConfigFiles(cfg *mybase.Config) {
globalFilePaths := []string{"/etc/skeema", "/usr/local/etc/skeema"}
home := filepath.Clean(os.Getenv("HOME"))
if home != "" {
globalFilePaths = append(globalFilePaths, path.Join(home, ".my.cnf"), path.Join(home, ".skeema"))
}
for _, path := range globalFilePaths {
- f := mycli.NewFile(path)
+ f := mybase.NewFile(path)
if !f.Exists() {
continue
}
Oops, something went wrong.

0 comments on commit 4cf282e

Please sign in to comment.