Skip to content

Commit

Permalink
Minors
Browse files Browse the repository at this point in the history
  • Loading branch information
krystian-panek-vmltech committed Sep 16, 2023
1 parent 498a9c9 commit 43fe2ce
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cmd/aem/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (c *CLI) fileDownloadCmd() *cobra.Command {
}
cmd.Flags().String("url", "", "Source file URL")
_ = cmd.MarkFlagRequired("url")
cmd.Flags().String("file", "", "Destination file path")
cmd.Flags().String("file", "", "Local file path")
_ = cmd.MarkFlagRequired("file")
cmd.Flags().String("auth-basic", "", "Basic Authorization (in format 'user:password')")
cmd.Flags().String("auth-token", "", "Token Authorization")
Expand Down
10 changes: 5 additions & 5 deletions cmd/aem/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,14 +440,14 @@ func (c *CLI) pkgBuildCmd() *cobra.Command {

func pkgDefineFlags(cmd *cobra.Command) {
cmd.Flags().String("pid", "", "ID (group:name:version)'")
cmd.Flags().String("file", "", "Local path on file system")
cmd.Flags().String("path", "", "Remote path on AEM repository")
cmd.Flags().String("file", "", "Local file path")
cmd.Flags().String("path", "", "Remote repository path")
cmd.MarkFlagsMutuallyExclusive("pid", "file", "path")
}

func pkgDefineDownloadFlags(cmd *cobra.Command) {
cmd.Flags().String("pid", "", "ID (group:name:version)'")
cmd.Flags().String("path", "", "Remote path on AEM repository")
cmd.Flags().String("path", "", "Remote repository path")
cmd.Flags().StringP("target-file", "t", "", "Target file path")
cmd.Flags().BoolP("force", "f", false, "Download even when already downloaded")
_ = cmd.MarkFlagRequired("file")
Expand All @@ -457,7 +457,7 @@ func pkgDefineDownloadFlags(cmd *cobra.Command) {

func pkgDefineUpdateFlags(cmd *cobra.Command) {
cmd.Flags().String("pid", "", "ID (group:name:version)'")
cmd.Flags().String("path", "", "Remote path on AEM repository")
cmd.Flags().String("path", "", "Remote repository path")
cmd.Flags().StringSliceP("filter-roots", "r", []string{}, "Vault filter root paths")
cmd.MarkFlagsOneRequired("pid", "path")
cmd.MarkFlagsMutuallyExclusive("pid", "path")
Expand All @@ -474,7 +474,7 @@ func pkgDefineCreateFlags(cmd *cobra.Command) {

func pkgDefineBuildFlags(cmd *cobra.Command) {
cmd.Flags().String("pid", "", "ID (group:name:version)'")
cmd.Flags().String("path", "", "Remote path on AEM repository")
cmd.Flags().String("path", "", "Remote repository path")
cmd.MarkFlagsMutuallyExclusive("pid", "path")
cmd.Flags().BoolP("force", "f", false, "Build even when already built")
cmd.MarkFlagsOneRequired("pid", "path")
Expand Down
2 changes: 1 addition & 1 deletion pkg/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (p Package) UpdateFilters(filters []PackageFilter) error {
return err
}
if !state.Exists {
return fmt.Errorf("%s > filters for package '%s' cannot be updated as it does not exist", p.manager.instance.ID(), p.PID.String())
return fmt.Errorf("%s > filters of package '%s' cannot be updated as it does not exist", p.manager.instance.ID(), p.PID.String())
}
return p.manager.UpdateFilters(state.Data.Path, state.PID, filters)
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/package_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ type PackageFilterRule struct {
}

func (pm *PackageManager) UpdateFilters(remotePath string, pid string, filters []PackageFilter) error {
log.Infof("%s > updating package '%s'", pm.instance.ID(), pid)
log.Infof("%s > updating filters of package '%s'", pm.instance.ID(), pid)
pidConfig, err := pkg.ParsePID(pid)
if err != nil {
return err
Expand All @@ -249,18 +249,18 @@ func (pm *PackageManager) UpdateFilters(remotePath string, pid string, filters [
}).
Post(UpdatePath)
if err != nil {
return fmt.Errorf("%s > cannot update filters for package '%s': %w", pm.instance.ID(), pid, err)
return fmt.Errorf("%s > cannot update filters of package '%s': %w", pm.instance.ID(), pid, err)
} else if response.IsError() {
return fmt.Errorf("%s > cannot update filters for package '%s': %s", pm.instance.ID(), pid, response.Status())
return fmt.Errorf("%s > cannot update filters of package '%s': %s", pm.instance.ID(), pid, response.Status())
}
var status pkg.CommandResult
if err = fmtx.UnmarshalJSON(response.RawBody(), &status); err != nil {
return fmt.Errorf("%s > cannot update filters for package '%s'; cannot parse response: %w", pm.instance.ID(), pid, err)
return fmt.Errorf("%s > cannot update filters of package '%s'; cannot parse response: %w", pm.instance.ID(), pid, err)
}
if !status.Success {
return fmt.Errorf("%s > cannot update filters for package '%s'; unexpected status: %s", pm.instance.ID(), pid, status.Message)
return fmt.Errorf("%s > cannot update filters of package '%s'; unexpected status: %s", pm.instance.ID(), pid, status.Message)
}
log.Infof("%s > update filters for package '%s'", pm.instance.ID(), pid)
log.Infof("%s > updated filters of package '%s'", pm.instance.ID(), pid)
return nil
}

Expand Down

0 comments on commit 43fe2ce

Please sign in to comment.