diff --git a/cmd/account/account_producer_extension_list.go b/cmd/account/account_producer_extension_list.go index e149c674..d8794635 100644 --- a/cmd/account/account_producer_extension_list.go +++ b/cmd/account/account_producer_extension_list.go @@ -59,7 +59,7 @@ func init() { accountCompanyProducerExtensionListCmd.Flags().StringVar(&listExtensionSearch, "search", "", "Filter by name") accountCompanyProducerExtensionListCmd.Flags().BoolVar(&listExtensionPlugin, "plugin", false, "Show only plugins") accountCompanyProducerExtensionListCmd.Flags().BoolVar(&listExtensionApp, "app", false, "Show only apps") - accountCompanyProducerExtensionListCmd.Flags().StringVar(&listExtensionFormat, "format", string(tui.TableFormatTable), "Output format (table or json)") + accountCompanyProducerExtensionListCmd.Flags().StringVar(&listExtensionFormat, "format", string(tui.TableFormatTable), "Output format (table, json)") accountCompanyProducerExtensionListCmd.Flags().BoolVar(&listExtensionJSON, "json", false, "Output as JSON") accountCompanyProducerExtensionListCmd.MarkFlagsMutuallyExclusive("plugin", "app") accountCompanyProducerExtensionListCmd.MarkFlagsMutuallyExclusive("format", "json") diff --git a/cmd/project/project_admin_api.go b/cmd/project/project_admin_api.go index 165880e6..0b7b497c 100644 --- a/cmd/project/project_admin_api.go +++ b/cmd/project/project_admin_api.go @@ -17,6 +17,7 @@ var skipDefaultHeaders bool var projectAdminApiCmd = &cobra.Command{ Use: "admin-api [method] [path]", + Args: cobra.ArbitraryArgs, Short: "Run authenticated curl requests against the Shopware Admin API", RunE: func(cobraCmd *cobra.Command, args []string) error { projectRoot, err := shop.FindClosestShopwareProject(true) diff --git a/cmd/project/project_create.go b/cmd/project/project_create.go index 42dbe0cb..85865657 100644 --- a/cmd/project/project_create.go +++ b/cmd/project/project_create.go @@ -238,7 +238,7 @@ func init() { projectCreateCmd.PersistentFlags().Bool("git", false, "Initialize a Git repository for a Shopware project") projectCreateCmd.PersistentFlags().Bool("local-domain", false, "Serve the Shopware project at a stable local hostname (."+proxy.DefaultDomain+" by default) through the shared proxy instead of a port (requires Docker)") projectCreateCmd.PersistentFlags().String("version", "", "Shopware version to install (e.g. 6.6.0.0, latest, dev-trunk)") - projectCreateCmd.PersistentFlags().String("deployment", "", "Deployment method to configure (none, container, deployer, platformsh, or shopware-paas)") + projectCreateCmd.PersistentFlags().String("deployment", "", "Deployment method to configure (none, container, deployer, platformsh, shopware-paas)") _ = projectCreateCmd.RegisterFlagCompletionFunc("deployment", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { return []string{ shop.DeploymentNone, @@ -248,7 +248,7 @@ func init() { shop.DeploymentShopwarePaaS, }, cobra.ShellCompDirectiveNoFileComp }) - projectCreateCmd.PersistentFlags().String("ci", "", "CI/CD system to configure (none, github, or gitlab)") + projectCreateCmd.PersistentFlags().String("ci", "", "CI/CD system to configure (none, github, gitlab)") projectCreateCmd.PersistentFlags().String("php-version", "", "PHP version for the project (e.g. 8.4); uses the local PHP version for local projects or the image tag for Docker projects") _ = projectCreateCmd.RegisterFlagCompletionFunc("php-version", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { return shop.SupportedPHPVersions, cobra.ShellCompDirectiveNoFileComp diff --git a/cmd/project/project_extension_list.go b/cmd/project/project_extension_list.go index 991a6492..8bba9a46 100644 --- a/cmd/project/project_extension_list.go +++ b/cmd/project/project_extension_list.go @@ -63,7 +63,7 @@ func projectExtensionListTable(extensions adminSdk.ExtensionList) *tui.Table { func init() { projectExtensionCmd.AddCommand(projectExtensionListCmd) - projectExtensionListCmd.Flags().String("format", string(tui.TableFormatTable), "Output format (table or json)") + projectExtensionListCmd.Flags().String("format", string(tui.TableFormatTable), "Output format (table, json)") projectExtensionListCmd.Flags().Bool("json", false, "Output as JSON") projectExtensionListCmd.MarkFlagsMutuallyExclusive("format", "json") _ = projectExtensionListCmd.Flags().MarkDeprecated("json", "use --format json instead") diff --git a/cmd/project/project_extension_outdated.go b/cmd/project/project_extension_outdated.go index ca6590e2..7c953594 100644 --- a/cmd/project/project_extension_outdated.go +++ b/cmd/project/project_extension_outdated.go @@ -80,7 +80,7 @@ func projectExtensionOutdatedTable(extensions adminSdk.ExtensionList) *tui.Table func init() { projectExtensionCmd.AddCommand(projectExtensionOutdatedCmd) - projectExtensionOutdatedCmd.Flags().String("format", string(tui.TableFormatTable), "Output format (table or json)") + projectExtensionOutdatedCmd.Flags().String("format", string(tui.TableFormatTable), "Output format (table, json)") projectExtensionOutdatedCmd.Flags().Bool("json", false, "Output as JSON") projectExtensionOutdatedCmd.MarkFlagsMutuallyExclusive("format", "json") _ = projectExtensionOutdatedCmd.Flags().MarkDeprecated("json", "use --format json instead") diff --git a/cmd/project/project_generate_jwt.go b/cmd/project/project_generate_jwt.go index e606b3ae..26a103b1 100644 --- a/cmd/project/project_generate_jwt.go +++ b/cmd/project/project_generate_jwt.go @@ -78,7 +78,7 @@ func generatePrivatePublicKey(keyLength int) ([]byte, []byte, error) { rsaPrivKey := encodePrivateKeyToPEM(rsaKey) rsaPubKey, err := generatePublicKey(rsaKey) if err != nil { - return nil, nil, fmt.Errorf("unable to generate public key: %v", err) + return nil, nil, fmt.Errorf("cannot generate public key: %w", err) } return rsaPubKey, rsaPrivKey, nil diff --git a/cmd/project/project_sql.go b/cmd/project/project_sql.go index 8d8e595f..ef655d12 100644 --- a/cmd/project/project_sql.go +++ b/cmd/project/project_sql.go @@ -130,6 +130,6 @@ func isTerminalStream(stream any) bool { func init() { projectRootCmd.AddCommand(projectSQLCmd) - projectSQLCmd.Flags().String("format", "", "Output format: table, tsv, or json (default: table when stdout is a terminal, tsv otherwise)") + projectSQLCmd.Flags().String("format", "", "Output format (table, tsv, json); defaults to table when stdout is a terminal, tsv otherwise") projectSQLCmd.Flags().String("file", "", "Path to a SQL file to execute (instead of a query argument or stdin)") } diff --git a/cmd/project/project_upgrade_check.go b/cmd/project/project_upgrade_check.go index 35bcb056..4fd2a458 100644 --- a/cmd/project/project_upgrade_check.go +++ b/cmd/project/project_upgrade_check.go @@ -26,6 +26,7 @@ import ( var projectUpgradeCheckCmd = &cobra.Command{ Use: "upgrade-check", + Args: cobra.NoArgs, Short: "Check that installed extensions are compatible with a future Shopware version", Deprecated: "use \"project upgrade\" instead, will be removed in October 2026", RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/project/project_worker.go b/cmd/project/project_worker.go index 67990a9f..708d8427 100644 --- a/cmd/project/project_worker.go +++ b/cmd/project/project_worker.go @@ -19,6 +19,7 @@ import ( var projectWorkerCmd = &cobra.Command{ Use: "worker [amount | queue-spec]", + Args: cobra.MaximumNArgs(1), Short: "Start and supervise Symfony Messenger consumers concurrently", Long: `Run multiple Symfony Messenger consumers in the background. diff --git a/internal/account-api/login.go b/internal/account-api/login.go index 5147586d..24612e09 100644 --- a/internal/account-api/login.go +++ b/internal/account-api/login.go @@ -40,7 +40,7 @@ func NewApi(ctx context.Context) (*Client, error) { password := os.Getenv("SHOPWARE_CLI_ACCOUNT_PASSWORD") if email != "" && password != "" { - logging.FromContext(ctx).Warnf("authentication with username/password is deprecated and will be removed in future. Please switch to OAuth2 client credentials, see https://developer.shopware.com/docs/products/cli/shopware-account-commands/authentication.html") + logging.FromContext(ctx).Warnf("Authentication with username and password is deprecated and will be removed in the future. Switch to OAuth2 client credentials: https://developer.shopware.com/docs/products/cli/shopware-account-commands/authentication.html") return loginWithCredentials(ctx, email, password) } diff --git a/internal/account-api/producer_store_pull.go b/internal/account-api/producer_store_pull.go index 47813d64..98a0fd76 100644 --- a/internal/account-api/producer_store_pull.go +++ b/internal/account-api/producer_store_pull.go @@ -255,7 +255,7 @@ func downloadFileTo(ctx context.Context, client *http.Client, url string, target defer func() { if err := resp.Body.Close(); err != nil { - logging.FromContext(ctx).Errorf("downloadFileTo: %v", err) + logging.FromContext(ctx).Errorf("Cannot close the download response: %v", err) } }() diff --git a/internal/account-api/producer_store_push.go b/internal/account-api/producer_store_push.go index 0cced36e..e29c1bde 100644 --- a/internal/account-api/producer_store_push.go +++ b/internal/account-api/producer_store_push.go @@ -327,7 +327,7 @@ func parseInlineablePath(path, extensionDir string) (string, error) { content, err := os.ReadFile(filePath) if err != nil { - return "", fmt.Errorf("error reading file at path %s with error: %v", filePath, err) + return "", fmt.Errorf("cannot read %s: %w", filePath, err) } if filepath.Ext(filePath) != ".md" { @@ -336,7 +336,7 @@ func parseInlineablePath(path, extensionDir string) (string, error) { html, err := markdown.ToHTML(content) if err != nil { - return "", fmt.Errorf("cannot convert file at path %s from markdown to html with error: %v", filePath, err) + return "", fmt.Errorf("cannot convert %s from Markdown to HTML: %w", filePath, err) } return html, nil diff --git a/internal/account-api/producer_store_push_test.go b/internal/account-api/producer_store_push_test.go index ae3e28ec..db047506 100644 --- a/internal/account-api/producer_store_push_test.go +++ b/internal/account-api/producer_store_push_test.go @@ -196,7 +196,7 @@ func TestParseInlineablePathMissingFile(t *testing.T) { _, err := parseInlineablePath("file:missing.html", t.TempDir()) require.Error(t, err) - assert.Contains(t, err.Error(), "error reading file") + assert.Contains(t, err.Error(), "cannot read") } func TestLanguageFromLocale(t *testing.T) { diff --git a/internal/archiver/zip.go b/internal/archiver/zip.go index d154f3d9..e7606907 100644 --- a/internal/archiver/zip.go +++ b/internal/archiver/zip.go @@ -19,7 +19,7 @@ func Unzip(r *zip.Reader, dest string) error { // Check for ZipSlip. More Info: http://bit.ly/2MsjAWE if !strings.HasPrefix(fpath, filepath.Clean(dest)+string(os.PathSeparator)) { - return fmt.Errorf("Unzip: %s: illegal file path", fpath) + return fmt.Errorf("unzip: illegal file path %s", fpath) } if f.FileInfo().IsDir() { diff --git a/internal/changelog/changelog.go b/internal/changelog/changelog.go index ba90d8aa..76c8b08d 100644 --- a/internal/changelog/changelog.go +++ b/internal/changelog/changelog.go @@ -113,7 +113,7 @@ func renderChangelog(commits []git.GitCommit, cfg Config) (string, error) { var buf bytes.Buffer if err := templateParsed.Execute(&buf, templateContext); err != nil { - return "", fmt.Errorf("failed to execute template: %v", err) + return "", fmt.Errorf("cannot execute changelog template: %w", err) } return strings.Trim(buf.String(), "\n"), nil diff --git a/internal/esbuild/download_unix.go b/internal/esbuild/download_unix.go index 008be45f..7e931ecc 100644 --- a/internal/esbuild/download_unix.go +++ b/internal/esbuild/download_unix.go @@ -112,7 +112,7 @@ func detectDownloadPrefix(ctx context.Context) string { resp, err := exec.CommandContext(ctx, "ldd", "--version").CombinedOutput() if resp == nil { - logging.FromContext(ctx).Infof("cannot run ldd to determine which dart-sass build is requierd: %s, using gnu libc", err) + logging.FromContext(ctx).Warnf("Cannot run ldd to determine which dart-sass build is required: %s, using gnu libc", err) return "" } diff --git a/internal/extension/asset_platform.go b/internal/extension/asset_platform.go index 0a491296..e57562a3 100644 --- a/internal/extension/asset_platform.go +++ b/internal/extension/asset_platform.go @@ -351,7 +351,7 @@ func prepareShopwareForAsset(shopwareRoot string, cfgs ExtensionAssetConfig, ass if _, err := os.Stat(varFolder); os.IsNotExist(err) { err := os.Mkdir(varFolder, 0o755) if err != nil { - return fmt.Errorf("prepareShopwareForAsset: %w", err) + return fmt.Errorf("cannot create %s: %w", varFolder, err) } } @@ -373,16 +373,16 @@ func prepareShopwareForAsset(shopwareRoot string, cfgs ExtensionAssetConfig, ass pluginJson, err := json.Marshal(normalized) if err != nil { - return fmt.Errorf("prepareShopwareForAsset: %w", err) + return fmt.Errorf("cannot encode plugins.json: %w", err) } if err = os.WriteFile(shopwareRoot+"/var/plugins.json", pluginJson, os.ModePerm); err != nil { - return fmt.Errorf("prepareShopwareForAsset: %w", err) + return fmt.Errorf("cannot write %s: %w", shopwareRoot+"/var/plugins.json", err) } err = os.WriteFile(shopwareRoot+"/var/features.json", []byte("{}"), 0o644) if err != nil { - return fmt.Errorf("prepareShopwareForAsset: %w", err) + return fmt.Errorf("cannot write %s: %w", shopwareRoot+"/var/features.json", err) } return nil diff --git a/internal/extension/zip.go b/internal/extension/zip.go index adeed174..73a58655 100644 --- a/internal/extension/zip.go +++ b/internal/extension/zip.go @@ -19,7 +19,7 @@ import ( ) func PrepareFolderForZipping(ctx context.Context, path string, ext Extension, extCfg *Config) error { - errorFormat := "PrepareFolderForZipping: %v" + errorFormat := "cannot prepare the extension folder for packaging: %w" composerJSONPath := filepath.Join(path, "composer.json") composerLockPath := filepath.Join(path, "composer.lock") diff --git a/internal/shop/config.go b/internal/shop/config.go index 26b920b8..09b9730e 100644 --- a/internal/shop/config.go +++ b/internal/shop/config.go @@ -953,7 +953,7 @@ func applyLocalOverride(ctx context.Context, fileName string, hasBase bool, conf localFile := LocalConfigFileName(fileName) if _, err := os.Stat(localFile); err != nil { if !os.IsNotExist(err) { - logging.FromContext(ctx).Warnf("unable to access local config override %s: %v", localFile, err) + logging.FromContext(ctx).Warnf("Cannot access local config override %s: %v", localFile, err) } return false, nil }