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

Export CLI reference as JSON #3

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Silic0nS0ldier
Copy link
Owner

@Silic0nS0ldier Silic0nS0ldier commented May 27, 2023

The goal of this prototype is to create a better CLI reference. With this extractor prototype completed, work on the UI/UX can now begin.

Some notes on the data.

  1. Select commands inherit options from an abnormal source. These options will have configuration in their associatedScopes property. Commands which inherit this will have usesConfigurationOptions = true.
  2. Commands can inherit options, build being the best known example. coverage and cquery are outliers, inheriting from test.
  3. To reduce repetition, all possible options have been consolidated into a single list. As hinted at in (1) associatedScopes indicates what a command belongs to ((command)|startup|common|configuration). Inheritance logic should be applied to this field to determine definitively if an option belongs to a command.
  4. Normally hidden fields are included, though properties exist to detect if a field should be hidden.
  5. Some fields may not make sense or be inconsistent with the existing Bazel CLI reference. There is business logic applied in other codepaths that this new code may not be applying.

Sample output.

{
    "options": [
        [
            "bazelrc",
            {
                "associatedScopes": [
                    "startup"
                ],
                "helpText": "The location of the user .bazelrc file containing default values of Bazel options. /dev/null indicates that all further `--bazelrc`s will be ignored, which is useful to disable the search for a user rc file, e.g. in release builds.\nThis option can also be specified multiple times.\nE.g. with `--bazelrc=x.rc --bazelrc=y.rc --bazelrc=/dev/null --bazelrc=z.rc`,\n  1) x.rc and y.rc are read.\n  2) z.rc is ignored due to the prior /dev/null.\nIf unspecified, Bazel uses the first .bazelrc file it finds in the following two locations: the workspace directory, then the user's home directory.\nNote: command line options will always supersede any option in bazelrc.",
                "abbreviation": null,
                "allowsMultiple": false,
                "hasNegativeOption": false,
                "isExpansionOption": false,
                "deprecationWarning": "",
                "oldName": "",
                "warnOldName": true,
                "documenationCategory": "bazel_client_options",
                "valueHelp": "<path>",
                "optionExpansions": [],
                "implicitRequirements": [],
                "optionEffectTags": [
                    "changes_inputs"
                ],
                "optionMetadataTags": []
            }
        ],
        ...
    },
    "commands": {
        "analyze-profile": {
            "shortDescription": "Analyzes build profile data.",
            "isHidden": false,
            "triggersBuild": false,
            "mustRunInWorkspace": false,
            "completion": "path",
            "usesConfigurationOptions": false,
            "inherits": []
        },
        ...
    },
    "optionEffectTags": {
        "unknown": {
            "description": "This option has unknown, or undocumented, effect."
        },
        ...
    },
    "optionMetadataTags": {
        "experimental": {
            "description": "This option triggers an experimental feature with no guarantees of functionality.",
            "hidden": false,
            "internal": false
        },
        ...
    }
}

@Silic0nS0ldier Silic0nS0ldier changed the base branch from master to jordan-mele_bzlmod_handle-override-not-existing May 27, 2023 11:42
@Silic0nS0ldier Silic0nS0ldier changed the base branch from jordan-mele_bzlmod_handle-override-not-existing to master May 27, 2023 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant