Skip to content

Commit 1990286

Browse files
Replace raw usage of fmt.Print with pcio.Print (#73)
## Problem There's confirmation prompts where we're using `fmt.Print` directly rather than `pcio.Print`. We're going to be refactoring the pcio package more broadly, so for now just align the raw Print calls with the shim'd package. ## Solution Replace raw usage of `fmt.Print` with `pcio.Print`. ## Type of Change - [X] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update - [ ] Infrastructure change (CI configs, etc) - [ ] Non-code change (docs, etc) - [ ] None of the above: (explain here) ## Test Plan There should be no user-visible change due to this code change. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: small output-path changes for interactive prompts, with one error-message formatting tweak; no API or deletion logic changes. > > **Overview** > Switches several destructive-action confirmation prompts (API key, project, organization, and local key prune) from `fmt.Print` to `pcio.Print` so prompt output respects the CLI’s `pcio` shim/quiet-mode behavior. > > Also standardizes the input read error path in `auth local-keys prune` to use `msg.FailMsg` instead of printing directly to stdout. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4f97284. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 42e1039 commit 1990286

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

internal/pkg/cli/command/apiKey/delete.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/pinecone-io/cli/internal/pkg/utils/exit"
1212
"github.com/pinecone-io/cli/internal/pkg/utils/help"
1313
"github.com/pinecone-io/cli/internal/pkg/utils/msg"
14+
"github.com/pinecone-io/cli/internal/pkg/utils/pcio"
1415
"github.com/pinecone-io/cli/internal/pkg/utils/sdk"
1516
"github.com/pinecone-io/cli/internal/pkg/utils/style"
1617
"github.com/pinecone-io/cli/internal/pkg/utils/text"
@@ -103,7 +104,7 @@ func confirmDeleteApiKey(apiKeyName string) {
103104
msg.WarnMsg("This action cannot be undone.")
104105

105106
// Prompt the user
106-
fmt.Print("Do you want to continue? (y/N): ")
107+
pcio.Print("Do you want to continue? (y/N): ")
107108

108109
// Read the user's input
109110
reader := bufio.NewReader(os.Stdin)

internal/pkg/cli/command/auth/local_keys_prune.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@ func confirmPruneKeys(plan []planItem, options pruneLocalKeysCmdOptions) (bool,
191191
msg.WarnMsg("This action cannot be undone.")
192192

193193
// Prompt the user
194-
fmt.Print("Do you want to continue? (y/N): ")
194+
pcio.Print("Do you want to continue? (y/N): ")
195195

196196
// Read the user's input
197197
reader := bufio.NewReader(os.Stdin)
198198
input, err := reader.ReadString('\n')
199199
if err != nil {
200-
fmt.Println("Error reading input:", err)
200+
msg.FailMsg("Error reading input: %+v", err)
201201
return false, err
202202
}
203203

internal/pkg/cli/command/organization/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func confirmDelete(organizationName string, organizationID string) {
104104
msg.WarnMsg("This action cannot be undone.")
105105

106106
// Prompt the user
107-
fmt.Print("Do you want to continue? (y/N): ")
107+
pcio.Print("Do you want to continue? (y/N): ")
108108

109109
// Read the user's input
110110
reader := bufio.NewReader(os.Stdin)

internal/pkg/cli/command/project/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func confirmDelete(projectName string) {
117117
msg.WarnMsg("This action cannot be undone.")
118118

119119
// Prompt the user
120-
fmt.Print("Do you want to continue? (y/N): ")
120+
pcio.Print("Do you want to continue? (y/N): ")
121121

122122
// Read the user's input
123123
reader := bufio.NewReader(os.Stdin)

0 commit comments

Comments
 (0)