Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create dolt_help system table #8739

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

milogreg
Copy link
Contributor

Created the dolt_help system table. This table is meant to store documentation for system tables, procedures, functions, and variables. Currently dolt_help is only populated with documentation for procedures, and only procedures that have equivalent CLI commands.

Part of #7984

Copy link
Member

@zachmu zachmu 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 the right idea, but it's missing a few things. Check out the difference between the command line and sql output here:

select arguments from dolt_help where target = 'dolt_add';
+-------------------------------------------------------------------------------------------------------------------------------------+
| arguments                                                                                                                           |
+-------------------------------------------------------------------------------------------------------------------------------------+
| {"table": "Working table(s) to add to the list tables staged to be committed. The abbreviation '.' can be used to add all tables."} |
+-------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

v. command line:

% dolt add --help
NAME
        dolt add - Add table contents to the list of staged tables

SYNOPSIS
        dolt add [<table>...]

DESCRIPTION

        This command updates the list of tables using the current content found in the working root, to prepare the content staged for the next commit. It adds the current content of existing
        tables as a whole or remove tables that do not exist in the working root anymore.

        This command can be performed multiple times before a commit. It only adds the content of the specified table(s) at the time the add command is run; if you want subsequent changes
        included in the next commit, then you must run dolt add again to add the new content to the index.

        The dolt status command can be used to obtain a summary of which tables have changes that are staged for the next commit.

OPTIONS
        <table>
          Working table(s) to add to the list tables staged to be committed. The abbreviation '.' can be used to add all tables.

        -A, --all
          Stages any and all changes (adds, deletes, and modifications) except for ignored tables.

        -f, --force
          Allow adding otherwise ignored tables.

        -p, --patch
          Interactively select changes to add to the staged set.

So relative to the CLI, this is missing:

  • options (flags)
  • synopsis
  • <table> formatting for arguments

return NewHelpRowIter(), nil
}

type HelpRowIter struct {
Copy link
Member

Choose a reason for hiding this comment

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

Best practice here is to use a pointer for the receiver type and not the fields


if hasProcedure && docs != nil {
argsMap := map[string]string{}
for _, argHelp := range curr.Docs().ArgParser.ArgListHelp {
Copy link
Member

Choose a reason for hiding this comment

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

This is missing all the options (flags)

func (ht *HelpTable) Schema() sql.Schema {
return []*sql.Column{
{
Name: "target",
Copy link
Member

Choose a reason for hiding this comment

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

Would call this name instead

PrimaryKey: false,
DatabaseSource: ht.dbName,
},
{
Copy link
Member

Choose a reason for hiding this comment

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

Probably want a synopsis column in here for example usage, like the CLI help

@milogreg milogreg requested a review from zachmu January 14, 2025 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants