diff --git a/cmd/harbor/root/project/delete.go b/cmd/harbor/root/project/delete.go index 339ffe8a..d42930f7 100644 --- a/cmd/harbor/root/project/delete.go +++ b/cmd/harbor/root/project/delete.go @@ -39,12 +39,12 @@ func runDeleteProject(projectName string) error { credentialName := viper.GetString("current-credential-name") client := utils.GetClientByCredentialName(credentialName) ctx := context.Background() - response, err := client.Project.DeleteProject(ctx, &project.DeleteProjectParams{ProjectNameOrID: projectName}) + _, err := client.Project.DeleteProject(ctx, &project.DeleteProjectParams{ProjectNameOrID: projectName}) if err != nil { return err } - utils.PrintPayloadInJSONFormat(response) + log.Info("project deleted successfully") return nil } diff --git a/cmd/harbor/root/project/logs.go b/cmd/harbor/root/project/logs.go index df50fd94..21781aac 100644 --- a/cmd/harbor/root/project/logs.go +++ b/cmd/harbor/root/project/logs.go @@ -16,10 +16,17 @@ func LogsProjectCommmand() *cobra.Command { cmd := &cobra.Command{ Use: "logs", Short: "get project logs", - Args: cobra.ExactArgs(1), + Args: cobra.MaximumNArgs(1), Run: func(cmd *cobra.Command, args []string) { - projectName := args[0] - resp, err := runLogsProject(projectName) + var err error + var resp *project.GetLogsOK + if len(args) > 0 { + resp, err = runLogsProject(args[0]) + } else { + projectName := utils.GetProjectNameFromUser() + resp, err = runLogsProject(projectName) + } + if err != nil { log.Fatalf("failed to get project logs: %v", err) }