diff --git a/Readme.md b/Readme.md index 666cc94..8214577 100644 --- a/Readme.md +++ b/Readme.md @@ -36,7 +36,7 @@ go build To install Calcite CLI, you can use the following command: ``` -go get github.com/satyakommula96/calcite-cli +go install github.com/satyakommula96/calcite-cli@latest ``` ## Usage @@ -47,12 +47,19 @@ calcite-cli [flags] Flags: -- `--url`: Connection URL to the Calcite server (default: http://localhost:8080) -- `--serialization`: Serialization parameter (default: protobuf) -- `--enablePartitionPruning`: Enable Partition Pruning (default: true) -- `--distributedExecution`: Distributed Execution (default: false) +```commandline -Once the Calcite CLI prompt starts, you can enter your SQL queries. To exit the prompt, type `exit`. + -h, --help help for calcite + -m, --maxRowsTotal string The maxRowsTotal parameter sets the maximum number of rows to return for a given query + --params string Extra parameters for avatica connection (ex: "parameter1=value&...parameterN=value") + -p, --password string The password to use when authenticating against Avatica + -s, --schema string The schema path sets the default schema to use for this connection. + --serialization string Serialization parameter + --url string Connection URL (default "http://localhost:8080") + -u, --username string The user to use when authenticating against Avatica + ``` + +Once the Calcite CLI prompt starts, you can enter your SQL queries. To exit the prompt, type `exit` or `quit`. ## Dependencies @@ -60,6 +67,7 @@ This project uses the following third-party dependencies: - [github.com/apache/calcite-avatica-go/v5](https://github.com/apache/calcite-avatica-go/v5) - [github.com/olekukonko/tablewriter](https://github.com/olekukonko/tablewriter) - [github.com/spf13/cobra](https://github.com/spf13/cobra) +- [github.com/aranjan7/go-prompt](https://github.com/aranjan7/go-prompt) That's the basic usage of the Calcite CLI. You can customize the connection URL and other parameters using command flags. diff --git a/cli.go b/cli.go index 67ec940..925f305 100644 --- a/cli.go +++ b/cli.go @@ -48,12 +48,12 @@ func main() { // Define flags for connection URL and additional parameters rootCmd.Flags().StringVar(&connectionURL, "url", connectionURL, "Connection URL") rootCmd.Flags().StringVar(&serialization, "serialization", "", "Serialization parameter") - rootCmd.Flags().StringVar(&connectionParams, "params", "", "Extra parameters for avatica connection (ex: property=value&property=value)") + rootCmd.Flags().StringVar(&connectionParams, "params", "", "Extra parameters for avatica connection (ex: \"parameter1=value&...parameterN=value\")") rootCmd.Flags().StringVarP(&schema, "schema", "s", "", "The schema path sets the default schema to use for this connection.") - rootCmd.Flags().StringVarP(&user, "username", "u", "", "Username (required if password is set)") - rootCmd.Flags().StringVarP(&passwd, "password", "p", "", "Password (required if username is set)") + rootCmd.Flags().StringVarP(&user, "username", "u", "", "The user to use when authenticating against Avatica") + rootCmd.Flags().StringVarP(&passwd, "password", "p", "", "The password to use when authenticating against Avatica") rootCmd.MarkFlagsRequiredTogether("username", "password") - rootCmd.Flags().StringVarP(&maxRowsTotal, "maxRowsTotal", "m", "", "Serialization parameter") + rootCmd.Flags().StringVarP(&maxRowsTotal, "maxRowsTotal", "m", "", "The maxRowsTotal parameter sets the maximum number of rows to return for a given query") err := rootCmd.Execute() if err != nil {