From 465a187f5b38df69a357b7141bb95db105225c55 Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Fri, 14 Jun 2024 14:19:01 +0000 Subject: [PATCH] fix(cli): remove useless commands on connect - removed list databases and list tables for autocompletion --- cli/sqlc.go | 4 ---- connection.go | 12 +++++++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cli/sqlc.go b/cli/sqlc.go index 97d6521..a253006 100644 --- a/cli/sqlc.go +++ b/cli/sqlc.go @@ -502,16 +502,12 @@ func main() { prompt = "\\u@\\H:\\p/\\d > " refreshDB := false - if parameter.Database != "" { - refreshDB = true - } Loop: for { out.Flush() if refreshDB { db.Database, _ = db.GetDatabase() - go func() { dynamic_tokens = db.GetAutocompleteTokens() }() // Update the dynamic tokens in the background... } renderdPrompt := prompt diff --git a/connection.go b/connection.go index 6e64e2d..1592941 100644 --- a/connection.go +++ b/connection.go @@ -463,11 +463,17 @@ func connectionCommands(config SQCloudConfig) (string, []interface{}) { buffer += noblobCommand(config.NoBlob) } - buffer += maxdataCommand(config.MaxData) + if config.MaxData > 0 { + buffer += maxdataCommand(config.MaxData) + } - buffer += maxrowsCommand(config.MaxRows) + if config.MaxRows > 0 { + buffer += maxrowsCommand(config.MaxRows) + } - buffer += maxrowsetCommand(config.MaxRowset) + if config.MaxRowset > 0 { + buffer += maxrowsetCommand(config.MaxRowset) + } return buffer, args }