Skip to content

Conversation

@dlevy-msft-sql
Copy link
Contributor

@dlevy-msft-sql dlevy-msft-sql commented Jan 25, 2026

Summary

Adds the :help command to display available sqlcmd commands, improving compatibility with legacy ODBC sqlcmd.

Usage

1>sqlcmd :help
:!! [<command>]
  - Executes a command in the operating system shell.
:connect server[\instance] [-l timeout] [-U user [-P password]]
  - Connects to a SQL Server instance.
...

Changes

  • pkg/sqlcmd/commands.go: Added HELP command and helpCommand function
  • pkg/sqlcmd/commands_test.go: Added tests for command parsing and functionality
  • README.md: Added documentation

Testing

  • All tests pass
  • Build succeeds

Add the :help command to display available sqlcmd commands.
This improves compatibility with legacy ODBC sqlcmd.

Changes:
- Added HELP command to command registry
- Added helpCommand function with full command list
- Added tests for command parsing and functionality
- Updated README.md
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a :help meta-command to the Go sqlcmd implementation to improve parity with the legacy ODBC sqlcmd by listing available sqlcmd commands.

Changes:

  • Extend the Commands map with a new HELP command and implement helpCommand to print a built-in help text block.
  • Add parsing and behavior tests for the :help command in pkg/sqlcmd/commands_test.go.
  • Document the new :help behavior in the README.md under miscellaneous enhancements.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pkg/sqlcmd/commands.go Registers the HELP command in newCommands() and implements helpCommand to write a multi-line command reference to the current output.
pkg/sqlcmd/commands_test.go Extends command parsing tests to cover :HELP/:help and adds TestHelpCommand to verify that key commands appear in the help output.
README.md Adds a bullet describing :help as displaying the list of available sqlcmd commands, surfacing the new feature to users.

- Remove :serverlist and :perftrace from help text
- These commands are in separate PRs and not yet merged
- Help text should only list commands that exist in this branch
@dlevy-msft-sql
Copy link
Contributor Author

Closing: :help command is now included in PR #630 (serverlist) and PR #632 (perftrace) branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant