Skip to content

Commit

Permalink
improve the delete msg, and selection prompt for the logs command
Browse files Browse the repository at this point in the history
Signed-off-by: amands98 <amandeepsm.in@gmail.com>
  • Loading branch information
amands98 committed May 6, 2024
1 parent 8c950b2 commit e23210e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/harbor/root/project/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
13 changes: 10 additions & 3 deletions cmd/harbor/root/project/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit e23210e

Please sign in to comment.