Skip to content

aitable export data: local --format flag shadows global -f/--format, breaking -f json #421

@PeterGuy326

Description

@PeterGuy326

Summary

dws aitable export data cannot accept the global output flag -f / -f json. It fails with unknown shorthand flag: 'f' in -f.

Repro (deterministic, 3/3)

$ dws aitable export data -f json
{"error":{"category":"internal","code":5,"message":"unknown shorthand flag: 'f' in -f\nSee 'dws aitable export data --help' for usage."}}

Sibling commands are fine:

$ dws aitable base list -f json   # returns JSON normally

Root cause

internal/helpers/aitable_export_import.go:67 registers a local flag with the same long name as the global persistent output flag --format / -f:

cmd.Flags().String("format", "", i18n.T("导出格式:excel、attachment、excel_and_attachment、excel_with_inline_images"))

This local --format (export format) has no -f shorthand, so it shadows the global persistent --format/-f and the -f shorthand binding is lost on this command.

Precedent in this repo

The doc export path already avoids the collision by using --export-format:
internal/helpers/doc.go:166cmd.Flags().String("export-format", "", ...).

Suggested fix

Rename the aitable export local flag to --export-format (align with doc.go), or otherwise avoid colliding with the global --format/-f.

Impact

dws aitable export data cannot use -f json / any -f output format; breaks JSON-only / MCP consumers. Found on v1.0.34 (1e95d03).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: cliCLI 仓库可修复type: bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions