Skip to content

Add vtctldclient docs#1054

Merged
deepthi merged 5 commits intoprodfrom
andrew/vtctldclient-docs
Jun 14, 2022
Merged

Add vtctldclient docs#1054
deepthi merged 5 commits intoprodfrom
andrew/vtctldclient-docs

Conversation

@ajm188
Copy link
Copy Markdown
Contributor

@ajm188 ajm188 commented Jun 13, 2022

This adds docs for vtctldclient autogenerated via cobra/doc.GenMarkdownTreeCustom. I'm working on generalizing the backing code, but I think me just committing this is fine for 14.0 (but when we start moving more commands over in the next release, we should 100% have this tooling integrated).

Anyway, here's the steps (from vitessio/vitess):

➜  vitess git:(andrew/vtctldclient/autodoc) ✗ go build -o docgen ./go/cmd/vtctldclient/docgen
➜  vitess git:(andrew/vtctldclient/autodoc) ✗ ./docgen -d ./go/cmd/vtctldclient/doc
➜  vitess git:(andrew/vtctldclient/autodoc) ✗ mv ./go/cmd/vtctldclient/doc/vtctldclient.md ./go/cmd/vtctldclient/doc/_index.md
➜  vitess git:(andrew/vtctldclient/autodoc) ✗ cp ./go/cmd/vtctldclient/doc/*.md ~/dev/vtwebsite/content/en/docs/14.0/reference/programs/vtctldclient

(when I publish the tooling, that'll all be in a make target)

Andrew Mason added 2 commits June 13, 2022 09:59
Signed-off-by: Andrew Mason <andrew@planetscale.com>
Signed-off-by: Andrew Mason <andrew@planetscale.com>
@ajm188 ajm188 requested review from deepthi and mattlord June 13, 2022 14:03
@netlify
Copy link
Copy Markdown

netlify bot commented Jun 13, 2022

Deploy Preview for vitess ready!

Name Link
🔨 Latest commit 2ca675c
🔍 Latest deploy log https://app.netlify.com/sites/vitess/deploys/62a8d00a2d5c5f00097b1e22
😎 Deploy Preview https://deploy-preview-1054--vitess.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Copy Markdown
Contributor

@GuptaManan100 GuptaManan100 left a comment

Choose a reason for hiding this comment

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

GitHub is making this impossible to review! But I ❤️ it. Do we want one file for each command though or 1 long file?

@ajm188
Copy link
Copy Markdown
Contributor Author

ajm188 commented Jun 13, 2022

GitHub is making this impossible to review!

I'd recommend just looking at the deploy preview!! Every file is "the same" (except for vtctldclient which contains the summary).

Do we want one file for each command though or 1 long file?

This is the standard way that cobra auto doc works, so I'd rather stick with that than try to shoe-horn it into some other setup unless we have a specific reason to do so.

@deepthi
Copy link
Copy Markdown
Collaborator

deepthi commented Jun 13, 2022

---
## vtctldclient GetBackups


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Some commands like this one show an empty description on the preview. I think we need to add the right text to the source and regenerate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, i can go through the actual commands in vitessio/vitess tomorrow and add all those

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

will that be a follow up PR? If yes, this LGTM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

opened: vitessio/vitess#10502. after addressing any feedback there, i'll regenerate and we can merge this one!

@ajm188
Copy link
Copy Markdown
Contributor Author

ajm188 commented Jun 13, 2022

Clicking links on the preview is returning 404.
E.g. https://deploy-preview-1054--vitess.netlify.app/docs/14.0/reference/programs/vtctldclient/vtctldclient_AddCellInfo.md

ah shoot, i see the problem, will fix it up!

Signed-off-by: Andrew Mason <andrew@planetscale.com>
Copy link
Copy Markdown
Member

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

This is friggin awesome! 😃

Is --server really optional with vtctldclient? I see some commands imply that it is, e.g.

vtctldclient UpdateCellInfo [--root <root>] [--server-address <addr>] <cell>

And some commands don't mention it at all, e.g.:

vtctldclient DeleteKeyspace [--recursive|-r] [--force|-f] <keyspace> [flags]

Although for the latter I now see that it mentions those separately as being inherited. So maybe that part is fine (although I'd expect those to be in the usage output too).

@ajm188
Copy link
Copy Markdown
Contributor Author

ajm188 commented Jun 14, 2022

This is friggin awesome! 😃

Is --server really optional with vtctldclient? I see some commands imply that it is, e.g.

vtctldclient UpdateCellInfo [--root <root>] [--server-address <addr>] <cell>

And some commands don't mention it at all, e.g.:

vtctldclient DeleteKeyspace [--recursive|-r] [--force|-f] <keyspace> [flags]

Although for the latter I now see that it mentions those separately as being inherited. So maybe that part is fine (although I'd expect those to be in the usage output too).

You're mistaking the --server-address argument which is for only {Add,Update}CellInfo with the global --server flag that's defined at the command root.

--server lives here and is required

@ajm188
Copy link
Copy Markdown
Contributor Author

ajm188 commented Jun 14, 2022

Andrew Mason added 2 commits June 14, 2022 14:13
Signed-off-by: Andrew Mason <andrew@planetscale.com>
Signed-off-by: Andrew Mason <andrew@planetscale.com>
@ajm188
Copy link
Copy Markdown
Contributor Author

ajm188 commented Jun 14, 2022

@deepthi okay i regenerated (and added the 15.0 versions), this should be good to go!

@mattlord
Copy link
Copy Markdown
Member

mattlord commented Jun 14, 2022

This is friggin awesome! 😃
Is --server really optional with vtctldclient? I see some commands imply that it is, e.g.

vtctldclient UpdateCellInfo [--root <root>] [--server-address <addr>] <cell>

And some commands don't mention it at all, e.g.:

vtctldclient DeleteKeyspace [--recursive|-r] [--force|-f] <keyspace> [flags]

Although for the latter I now see that it mentions those separately as being inherited. So maybe that part is fine (although I'd expect those to be in the usage output too).

You're mistaking the --server-address argument which is for only {Add,Update}CellInfo with the global --server flag that's defined at the command root.

Ah, right. Sorry!

--server lives here and is required

It doesn't seem to be required on the command pages though, the command usage doesn't show it without square brackets to indicate it's non-optional and in the inherited section it says:

--server string             server to use for connection

I'd prefer to show those inherited things in the full usage output for each command, but can we at least add e.g. --server string server to use for connection (required) as I don't see an indication that required is the default unless optional is specified either.

It's a nit obviously, and doesn't need to hold this up (we have no docs ATM so this is obviously much better). I'll approve so that you're unblocked. Thanks!

@mattlord
Copy link
Copy Markdown
Member

mattlord commented Jun 14, 2022

One general note, not specifically related to this PR, is that we don't seem to have a uniform way of showing usage related info when you must specify 1 of N options. For example, in some cases we use ~ this to signify that one of the two is required:

vtctldclient UpdateCellInfo {--root <root> | --server-address <addr>} <cell>

We can take the lead from pflags on that and update the docs everywhere to match over time.

@ajm188
Copy link
Copy Markdown
Contributor Author

ajm188 commented Jun 14, 2022

lemme fix that real quick!

as for the standardization, totally agree. it's grown organically over time, and before v15 release we should sit down (metaphorically 😂 ) and articulate what conventions we want to stick to (and then fix all my sins)

Copy link
Copy Markdown
Collaborator

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

LGTM

@deepthi deepthi merged commit eeb321e into prod Jun 14, 2022
@deepthi deepthi deleted the andrew/vtctldclient-docs branch June 14, 2022 18:40
@ajm188
Copy link
Copy Markdown
Contributor Author

ajm188 commented Jun 14, 2022

piled on the --server change in #1055 (specifically c9eff41)

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.

4 participants