Skip to content

Commit

Permalink
Minor help message update for inferring src/dst
Browse files Browse the repository at this point in the history
  • Loading branch information
zezha-msft committed Jan 11, 2019
1 parent 08a56fc commit d6d62f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ func init() {
syncCmd.PersistentFlags().StringVar(&raw.exclude, "exclude", "", "Filter: Exclude these files when copying. Support use of *.")
syncCmd.PersistentFlags().StringVar(&raw.output, "output", "text", "format of the command's output, the choices include: text, json")
syncCmd.PersistentFlags().StringVar(&raw.logVerbosity, "log-level", "WARNING", "define the log verbosity for the log file, available levels: INFO(all requests/responses), WARNING(slow responses), and ERROR(only failed requests).")
syncCmd.PersistentFlags().BoolVar(&raw.force, "force", false, "defines user's decision to delete file in difference in source and destination. "+
"If false, user will again be prompted with a question while queuing transfers for deletion")
syncCmd.PersistentFlags().BoolVar(&raw.force, "force", false, "defines user's decision to delete extra files at the destination that are not present at the source. "+
"If false, user will be prompted with a question while scheduling files/blobs for deletion.")

// TODO sync does not support any BlobAttributes, this functionality should be added
}
10 changes: 5 additions & 5 deletions cmd/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func validateFromTo(src, dst string, userSpecifiedFromTo string) (common.FromTo,
if userSpecifiedFromTo == "" {
// If user didn't explicitly specify FromTo, use what was inferred (if possible)
if inferredFromTo == common.EFromTo.Unknown() {
return common.EFromTo.Unknown(), fmt.Errorf("Unable to infer the source '%s' / destination '%s' combination. Please use the --FromTo switch ", src, dst)
return common.EFromTo.Unknown(), fmt.Errorf("the inferred source/destination combination is currently not supported. Please post an issue on Github if support for this scenario is desired")
}
return inferredFromTo, nil
}
Expand All @@ -43,7 +43,7 @@ func validateFromTo(src, dst string, userSpecifiedFromTo string) (common.FromTo,
var userFromTo common.FromTo
err := userFromTo.Parse(userSpecifiedFromTo)
if err != nil {
return common.EFromTo.Unknown(), fmt.Errorf("Invalid --FromTo value specified: %q", userSpecifiedFromTo)
return common.EFromTo.Unknown(), fmt.Errorf("invalid --FromTo value specified: %q", userSpecifiedFromTo)
}
if inferredFromTo == common.EFromTo.Unknown() || inferredFromTo == userFromTo ||
userFromTo == common.EFromTo.BlobTrash() || userFromTo == common.EFromTo.FileTrash() {
Expand All @@ -52,22 +52,22 @@ func validateFromTo(src, dst string, userSpecifiedFromTo string) (common.FromTo,
return userFromTo, nil
}
// inferredFromTo != raw.fromTo: What we inferred doesn't match what the user specified
return common.EFromTo.Unknown(), errors.New("The specified --FromTo swith is inconsistent with the specified source/destination combination.")
return common.EFromTo.Unknown(), errors.New("the specified --FromTo switch is inconsistent with the specified source/destination combination")
}

func inferFromTo(src, dst string) common.FromTo {
// Try to infer the 1st argument
srcLocation := inferArgumentLocation(src)
if srcLocation == srcLocation.Unknown() {
glcm.Info("Can't infer source location of " +
glcm.Info("Cannot infer source location of " +
common.URLStringExtension(src).RedactSigQueryParamForLogging() +
". Please specify the --FromTo switch")
return common.EFromTo.Unknown()
}

dstLocation := inferArgumentLocation(dst)
if dstLocation == dstLocation.Unknown() {
glcm.Info("Can't infer destination location of " +
glcm.Info("Cannot infer destination location of " +
common.URLStringExtension(dst).RedactSigQueryParamForLogging() +
". Please specify the --FromTo switch")
return common.EFromTo.Unknown()
Expand Down

0 comments on commit d6d62f0

Please sign in to comment.