Merge pull request #839 from harshavardhana/pr_out_rename_ismcconfigexist_to_ismcconfigexists_for_brevity
This commit is contained in:
+1
-1
@@ -64,7 +64,7 @@ func runAccessCmd(ctx *cli.Context) {
|
||||
if !ctx.Args().Present() || ctx.Args().First() == "help" {
|
||||
cli.ShowCommandHelpAndExit(ctx, "access", 1) // last argument is exit code
|
||||
}
|
||||
if !isMcConfigExist() {
|
||||
if !isMcConfigExists() {
|
||||
console.Fatals(ErrorMessage{
|
||||
Message: "Please run \"mc config generate\"",
|
||||
Error: iodine.New(errNotConfigured{}, nil),
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ func runCatCmd(ctx *cli.Context) {
|
||||
if !ctx.Args().Present() || ctx.Args().First() == "help" {
|
||||
cli.ShowCommandHelpAndExit(ctx, "cat", 1) // last argument is exit code
|
||||
}
|
||||
if !isMcConfigExist() {
|
||||
if !isMcConfigExists() {
|
||||
console.Fatals(ErrorMessage{
|
||||
Message: "Please run \"mc config generate\"",
|
||||
Error: iodine.New(errNotConfigured{}, nil),
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ func runConfigCmd(ctx *cli.Context) {
|
||||
func saveConfig(arg string, aliases []string) error {
|
||||
switch arg {
|
||||
case "generate":
|
||||
if isMcConfigExist() {
|
||||
if isMcConfigExists() {
|
||||
return iodine.New(errConfigExists{}, nil)
|
||||
}
|
||||
config, err := newConfig()
|
||||
|
||||
@@ -221,7 +221,7 @@ func runCopyCmd(ctx *cli.Context) {
|
||||
cli.ShowCommandHelpAndExit(ctx, "cp", 1) // last argument is exit code
|
||||
}
|
||||
|
||||
if !isMcConfigExist() {
|
||||
if !isMcConfigExists() {
|
||||
console.Fatals(ErrorMessage{
|
||||
Message: "Please run \"mc config generate\"",
|
||||
Error: iodine.New(errNotConfigured{}, nil),
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ func runDiffCmd(ctx *cli.Context) {
|
||||
if len(ctx.Args()) != 2 || ctx.Args().First() == "help" {
|
||||
cli.ShowCommandHelpAndExit(ctx, "diff", 1) // last argument is exit code
|
||||
}
|
||||
if !isMcConfigExist() {
|
||||
if !isMcConfigExists() {
|
||||
console.Fatals(ErrorMessage{
|
||||
Message: "Please run \"mc config generate\"",
|
||||
Error: iodine.New(errNotConfigured{}, nil),
|
||||
|
||||
@@ -83,7 +83,7 @@ func runListCmd(ctx *cli.Context) {
|
||||
cli.ShowCommandHelpAndExit(ctx, "ls", 1) // last argument is exit code
|
||||
}
|
||||
|
||||
if !isMcConfigExist() {
|
||||
if !isMcConfigExists() {
|
||||
console.Fatals(ErrorMessage{
|
||||
Message: "Please run \"mc config generate\"",
|
||||
Error: iodine.New(errNotConfigured{}, nil),
|
||||
|
||||
@@ -60,7 +60,7 @@ func runMakeBucketCmd(ctx *cli.Context) {
|
||||
if !ctx.Args().Present() || ctx.Args().First() == "help" {
|
||||
cli.ShowCommandHelpAndExit(ctx, "mb", 1) // last argument is exit code
|
||||
}
|
||||
if !isMcConfigExist() {
|
||||
if !isMcConfigExists() {
|
||||
console.Fatals(ErrorMessage{
|
||||
Message: "Please run \"mc config generate\"",
|
||||
Error: iodine.New(errNotConfigured{}, nil),
|
||||
|
||||
+1
-1
@@ -222,7 +222,7 @@ func runSyncCmd(ctx *cli.Context) {
|
||||
cli.ShowCommandHelpAndExit(ctx, "sync", 1) // last argument is exit code
|
||||
}
|
||||
|
||||
if !isMcConfigExist() {
|
||||
if !isMcConfigExists() {
|
||||
console.Fatals(ErrorMessage{
|
||||
Message: "Please run \"mc config generate\"",
|
||||
Error: iodine.New(errNotConfigured{}, nil),
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ func runUpdateCmd(ctx *cli.Context) {
|
||||
if ctx.Args().First() == "help" {
|
||||
cli.ShowCommandHelpAndExit(ctx, "update", 1) // last argument is exit code
|
||||
}
|
||||
if !isMcConfigExist() {
|
||||
if !isMcConfigExists() {
|
||||
console.Fatals(ErrorMessage{
|
||||
Message: "Please run \"mc config generate\"",
|
||||
Error: iodine.New(errNotConfigured{}, nil),
|
||||
|
||||
@@ -93,7 +93,7 @@ func mustGetMcConfigPath() string {
|
||||
|
||||
// getMcConfig - reads configuration file and returns config
|
||||
func getMcConfig() (*configV1, error) {
|
||||
if !isMcConfigExist() {
|
||||
if !isMcConfigExists() {
|
||||
return nil, iodine.New(errInvalidArgument{}, nil)
|
||||
}
|
||||
|
||||
@@ -122,8 +122,8 @@ func getMcConfig() (*configV1, error) {
|
||||
|
||||
}
|
||||
|
||||
// isMcConfigExist returns err if config doesn't exist
|
||||
func isMcConfigExist() bool {
|
||||
// isMcConfigExists xreturns err if config doesn't exist
|
||||
func isMcConfigExists() bool {
|
||||
configFile, err := getMcConfigPath()
|
||||
if err != nil {
|
||||
return false
|
||||
|
||||
@@ -40,7 +40,7 @@ func checkConfig() {
|
||||
}
|
||||
|
||||
// If config doesn't exist, do not attempt to read it
|
||||
if !isMcConfigExist() {
|
||||
if !isMcConfigExists() {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ func main() {
|
||||
return nil
|
||||
}
|
||||
app.After = func(ctx *cli.Context) error {
|
||||
if !isMcConfigExist() {
|
||||
if !isMcConfigExists() {
|
||||
console.Fatals(ErrorMessage{
|
||||
Message: "Please run \"mc config generate\"",
|
||||
Error: iodine.New(errNotConfigured{}, nil),
|
||||
|
||||
Reference in New Issue
Block a user