Skip to content

Conversation

@amoeba
Copy link
Member

@amoeba amoeba commented Nov 5, 2025

Adds the implementation and documentation for a new subcommand, docs.

If you run dbc docs with no driver, the main dbc docs site opens in your default browser. If you run dbc docs DRIVER, we look for that driver in the driver registry (the CDN). If not found, we error. If found, we look in a list of temporary, fallback URLs for a docs URL and open that. For drivers that exist in the registry but have no fallback URL, we error.

Closes #176

@amoeba amoeba requested review from ianmcook and zeroshade November 11, 2025 02:34
@amoeba
Copy link
Member Author

amoeba commented Nov 11, 2025

Tagged for reviews. I wasn't sure if I liked dbc doc or dbc docs better. Let me know.

@ianmcook
Copy link
Member

Thanks for doing this @amoeba. I prefer dbc docs.

@amoeba
Copy link
Member Author

amoeba commented Nov 11, 2025

Changed from "doc" to "docs" in daadd80.

@ianmcook do you want to take it for a test drive and @zeroshade do you want to check my implementation (code and tests)?

@ianmcook ianmcook changed the title feat(doc): add subcommand for opening documentation feat(docs): add subcommand for opening documentation Nov 11, 2025
@ianmcook
Copy link
Member

ianmcook commented Nov 11, 2025

Thanks @amoeba, this is great.

I'm wondering if we really need the y/n prompt. Does the courtesy of this outweigh the inconvenience? I'm aware of at least one other command-line tool that has an identical docs subcommand that does not prompt the user for permission before opening the browser: npm docs <package>. However it also has a --no-browser option that prints a message like this instead of opening the browser:

<package> docs available at the following URL:
https://example.com

@amoeba
Copy link
Member Author

amoeba commented Nov 12, 2025

I wasn't sure which I preferred and found I didn't have a lot of prior art to pull from. Another example is R in some cases (like Windows) and it doesn't prompt IIRC. The only other examples I could think of were some of the CLIs that do auth and those prompt but usually they are giving you instructions and sometimes a code to copy paste.

I'll rework this to not prompt and add a --no-open or similar flag.

@amoeba
Copy link
Member Author

amoeba commented Nov 13, 2025

This is all refactored now. It now just opens the URL without prompting or printing anything to the terminal. And it also supports a --no-open flag that works like this,

$ go run ./cmd/dbc docs --no-open
dbc docs are available at the following URL:
https://docs.columnar.tech/dbc/

~/src/columnar-tech/dbc feat/subcommand--doc
$ go run ./cmd/dbc docs sqlite --no-open
sqlite driver docs are available at the following URL:
https://arrow.apache.org/adbc/current/driver/sqlite.html

~/src/columnar-tech/dbc feat/subcommand--doc
$ go run ./cmd/dbc docs bigquery --no-open
Error: no documentation available for driver `bigquery`
exit status 1

I went with --no-open since we're already using --no-foo in at least one other place.

@amoeba
Copy link
Member Author

amoeba commented Nov 13, 2025

CI seems good, I manually tested on Windows just to be sure the package we're using is as cross-platform as they say they are. It seems to work :)

Ready for a final review @ianmcook

@ianmcook
Copy link
Member

Since this is a new subcommand, do we need to change anything in the shell completions?

@amoeba
Copy link
Member Author

amoeba commented Nov 13, 2025

Good call. We should do that during release. I'll go make sure that's in our checklist.

Copy link
Member

@ianmcook ianmcook left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

@amoeba amoeba merged commit fcdd191 into columnar-tech:main Nov 13, 2025
11 checks passed
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.

add dbc docs subcommand for opening and/or printing driver docs

2 participants