From 7f6c29da4e604e093e793f7064fc88ae74962b68 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Mon, 22 Jun 2026 17:41:44 +0800 Subject: [PATCH] chore: update command descriptions and comments --- cmd/intercmd.go | 2 +- cmd/version.go | 2 +- cmd/winsc_nonwindows.go | 2 +- cmd/winsc_windows.go | 2 +- pkg/core/certmgr/providers/aws-iam/aws_iam.go | 9 ++++----- .../deployer/providers/wangsu-cdnpro/wangsu_cdnpro.go | 4 +--- pkg/sdk3rd/matrix/client.go | 2 ++ 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/cmd/intercmd.go b/cmd/intercmd.go index 900038a4..3281ca90 100644 --- a/cmd/intercmd.go +++ b/cmd/intercmd.go @@ -20,7 +20,7 @@ import ( func NewInternalCommand(app core.App) *cobra.Command { command := &cobra.Command{ Use: "intercmd", - Short: "[INTERNAL] Internal dedicated for Certimate", + Short: "[RESERVED] PLEASE DO NOT USE!", } command.AddCommand(internalCertApplyCommand(app)) diff --git a/cmd/version.go b/cmd/version.go index 77202809..8a95d211 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -13,7 +13,7 @@ import ( func NewVersionCommand(_ core.App) *cobra.Command { command := &cobra.Command{ Use: "version", - Short: "Print the version information", + Short: "Prints version information", Run: func(cmd *cobra.Command, args []string) { fmt.Printf("Certimate v%s\n", app.AppVersion) fmt.Printf("Build with %s on %s_%s\n", runtime.Version(), runtime.GOOS, runtime.GOARCH) diff --git a/cmd/winsc_nonwindows.go b/cmd/winsc_nonwindows.go index 7908ee96..9baf441c 100644 --- a/cmd/winsc_nonwindows.go +++ b/cmd/winsc_nonwindows.go @@ -11,7 +11,7 @@ import ( func NewWinscCommand(app core.App) *cobra.Command { command := &cobra.Command{ Use: "winsc", - Short: "Install/Uninstall Windows service (Not supported on non-Windows OS)", + Short: "Manages Windows service (Not supported on non-Windows OS)", } return command diff --git a/cmd/winsc_windows.go b/cmd/winsc_windows.go index 4b790d3f..1c8e3d3b 100644 --- a/cmd/winsc_windows.go +++ b/cmd/winsc_windows.go @@ -23,7 +23,7 @@ const winscName = "certimate" func NewWinscCommand(app core.App) *cobra.Command { command := &cobra.Command{ Use: "winsc", - Short: "Install/Uninstall Windows service", + Short: "Manages Windows service", } command.AddCommand(winscInstallCommand(app)) diff --git a/pkg/core/certmgr/providers/aws-iam/aws_iam.go b/pkg/core/certmgr/providers/aws-iam/aws_iam.go index e5eaa66f..2d4d79a9 100644 --- a/pkg/core/certmgr/providers/aws-iam/aws_iam.go +++ b/pkg/core/certmgr/providers/aws-iam/aws_iam.go @@ -11,6 +11,7 @@ import ( awscfg "github.com/aws/aws-sdk-go-v2/config" awscred "github.com/aws/aws-sdk-go-v2/credentials" awsiam "github.com/aws/aws-sdk-go-v2/service/iam" + "github.com/samber/lo" "github.com/certimate-go/certimate/pkg/core" xcert "github.com/certimate-go/certimate/pkg/utils/cert" @@ -92,11 +93,9 @@ func (c *Certmgr) Upload(ctx context.Context, certPEM, privkeyPEM string) (*Uplo } listServerCertificatesReq := &awsiam.ListServerCertificatesInput{ - Marker: listServerCertificatesMarker, - MaxItems: aws.Int32(1000), - } - if c.config.CertificatePath != "" { - listServerCertificatesReq.PathPrefix = aws.String(c.config.CertificatePath) + PathPrefix: lo.EmptyableToPtr(c.config.CertificatePath), + Marker: listServerCertificatesMarker, + MaxItems: aws.Int32(1000), } listServerCertificatesResp, err := c.sdkClient.ListServerCertificates(ctx, listServerCertificatesReq) c.logger.Debug("sdk request 'iam.ListServerCertificates'", slog.Any("request", listServerCertificatesReq), slog.Any("response", listServerCertificatesResp)) diff --git a/pkg/core/deployer/providers/wangsu-cdnpro/wangsu_cdnpro.go b/pkg/core/deployer/providers/wangsu-cdnpro/wangsu_cdnpro.go index 58e8c9f5..a26bf264 100644 --- a/pkg/core/deployer/providers/wangsu-cdnpro/wangsu_cdnpro.go +++ b/pkg/core/deployer/providers/wangsu-cdnpro/wangsu_cdnpro.go @@ -180,9 +180,7 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*Dep Version: lo.ToPtr(wangsuCertVer), }, }, - } - if d.config.WebhookId != "" { - createDeploymentTaskReq.Webhook = lo.ToPtr(d.config.WebhookId) + Webhook: lo.EmptyableToPtr(d.config.WebhookId), } createDeploymentTaskResp, err := d.sdkClient.CreateDeploymentTaskWithContext(ctx, createDeploymentTaskReq) d.logger.Debug("sdk request 'cdnpro.CreateCertificate'", slog.Any("request", createDeploymentTaskReq), slog.Any("response", createDeploymentTaskResp)) diff --git a/pkg/sdk3rd/matrix/client.go b/pkg/sdk3rd/matrix/client.go index 3a47d9d8..378ad0d8 100644 --- a/pkg/sdk3rd/matrix/client.go +++ b/pkg/sdk3rd/matrix/client.go @@ -1,3 +1,5 @@ +// A simple SDK client for Matrix (ElementX). +// API documentation: https://spec.matrix.org/latest/client-server-api/ package matrix import (