Skip to content

[Bug or feature request] - document --language-version in dart format --help #1760

@cameron1024

Description

@cameron1024

I'm writing a tool that pipes generated Dart code into/out of dart format via
stdio, and was looking for a way to set the language version for the formatter
via the CLI (since there is no language constraint in the pubspec.yaml -
there is no pubspec.yaml!).

I came across this issue: #1402 ,
which suggests there is a --language-version flag, but after following the
discussion, it's not super clear what the status of this flag is. I can pass
the flag and it works, but I'm a bit worried it's been intentionally left
undocumented as a hint that it's experimental/unstable/subject to change, at
which point I wouldn't rely on it for a core part of a tool that's going to
process all the Dart code in my organization 😅 .

For context, when I run dart format --help I get this:

Idiomatically format Dart source code.

Usage: dart format [options...] <files or directories...>
-h, --help                     Print this usage information.
-v, --verbose                  Show all options and flags with --help.
-o, --output                   Set where to write formatted output.

          [write] (default)    Overwrite formatted files on disk.
          [show]               Print code to terminal.
          [json]               Print code and selection as JSON.
          [none]               Discard output.

    --set-exit-if-changed      Return exit code 1 if there are any formatting changes.

Run "dart help" to see global options.

on Dart 3.8.1.

If this is intentional, feel free to close this issue. I was just having
trouble finding any documentation on this feature. Seeing it --help would be
great for discoverability.

Thanks 😁

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions