-
Notifications
You must be signed in to change notification settings - Fork 67
Add --disable-prompts flag to suppress line prompts in non-interactive mode #582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@copilot the |
…e mode Co-authored-by: shueybubbles <[email protected]>
Co-authored-by: shueybubbles <[email protected]>
I've implemented the fix to properly detect when stdin is redirected. The updated code in Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
#Closed |
cmd/sqlcmd/sqlcmd.go
Outdated
@@ -438,6 +439,7 @@ func setFlags(rootCmd *cobra.Command, args *SQLCmdArguments) { | |||
rootCmd.Flags().BoolVarP(&args.EnableColumnEncryption, "enable-column-encryption", "g", false, localizer.Sprintf("Enable column encryption")) | |||
rootCmd.Flags().StringVarP(&args.ChangePassword, "change-password", "z", "", localizer.Sprintf("New password")) | |||
rootCmd.Flags().StringVarP(&args.ChangePasswordAndExit, "change-password-exit", "Z", "", localizer.Sprintf("New password and exit")) | |||
rootCmd.Flags().BoolVar(&args.DisablePrompts, "disable-prompts", false, localizer.Sprintf("Disables line prompts when running as a subprocess")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this new argument #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've already removed the --disable-prompts
flag as part of the implementation of automatic stdin redirection detection in commit 36accd3. The code now automatically detects when input is coming from a pipe or redirection and suppresses prompts accordingly without requiring an explicit flag.
…command line flag Co-authored-by: shueybubbles <[email protected]>
pkg/console/console_unix.go
Outdated
return true | ||
} | ||
|
||
// Double-check using isatty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the comment says isatty
but the code uses IsTerminal. This file is identical to console_windows.go. If the code for both platforms is identical, there's no need for separate code files. #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've consolidated the duplicate platform-specific files into a single console_redirect.go
file and fixed the comment to correctly refer to term.IsTerminal
instead of isatty
. The code is now more maintainable with the same functionality. The changes are in commit b9540ca.
…file Co-authored-by: shueybubbles <[email protected]>
This PR addresses the issue where line prompts (like "1>", "2>", "3>") appear in the output when running sqlcmd as a subprocess from another program.
Changes
DisablePrompts
field to theSqlcmd
struct inpkg/sqlcmd/sqlcmd.go
DisablePrompts
field to theSQLCmdArguments
struct incmd/sqlcmd/sqlcmd.go
--disable-prompts
that allows users to suppress these line promptsExample usage
When running sqlcmd as a subprocess with input/output via pipes, users can now add the
--disable-prompts
flag to get clean output without line prompts:This matches the behavior of the original sqlcmd tool when used in subprocess scenarios.
Fixes #580.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
someserver
/tmp/go-build1426325623/b001/sqlcmd.test -test.testlogfile=/tmp/go-build1426325623/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.