Skip to content

docs set-paragraph-style: add --style flag for heading level (namedStyleType) #147

@omriariav

Description

@omriariav

Problem

gws docs set-paragraph-style only supports --alignment and --line-spacing, but doesn't expose the Google Docs API's namedStyleType field. This means there's no way to change a paragraph from HEADING_2 to NORMAL_TEXT (or vice versa) via the CLI.

Use case

When using gws docs replace to insert text before a heading, the replacement text inherits the heading style. There's no CLI command to fix the paragraph style back to normal text afterward.

Suggested fix

Add a --style flag to set-paragraph-style that maps to the API's namedStyleType. Accepted values:

  • NORMAL_TEXT
  • HEADING_1 through HEADING_6
  • TITLE
  • SUBTITLE

Example usage:

gws docs set-paragraph-style <doc-id> --from 179 --to 799 --style NORMAL_TEXT

Related

The richformat content format on insert/append also doesn't work as expected for updateParagraphStyle requests - it inserts the JSON as literal text rather than executing it as a batch update. This may be a separate issue, but it means there's currently no workaround via the CLI.

API reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions