Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
29467: cli: make all client commands recognize `--url` r=knz a=knz Fixes #4984. Fixes #29567. Prior to this patch, the client commands using a SQL connection under the hood would accept `--url` in addition to discrete parameters (`--host`, `--port`, etc); however, non-SQL client commands did not recognize `--url`. This was causing UX pain/fatigue because users had to remember which commands accept a URL and which commands do not. It also made automation more difficult. (For context, it was not reasonable to propose to users to _never_ use `--url` and always stick to discrete flags, because some parameters can only be specified via `--url`, for example the application name.) This patch resolves the UX problem by ensuring that all client commands accept `--url`, in addition to the discrete flags. This effectively makes all CockroachDB commands (*) homogeneous/consistent wrt their connection flags. The value provided via `--url` and via the other discrete flags mesh as follows: ``` // flags parser // / \ // .-----' `-------. // | | // --url --host, --port, etc // | | // urlParser.Set() | // | | // `-------. .-------' // \ / // sqlCtx/cliCtx/baseCtx // | // / \ // .-------' `--------. // | | // | | // non-SQL makeClientConnURL() // commands | // (quit, init, etc) | // SQL commands // (user, zone, etc) ``` (*) except for `cockroach workload`, which still has the status an adopted appendage with its separate argument handling. Release note (cli change): All `cockroach` client sub-commands (except for `cockroach workload`) now support the `--url` flag. Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
- Loading branch information