Skip to content

Implement code formatting #42

Description

@avh4

#38 is a discussion of possible approaches. This issue tracks implementation progress for the current approach.

Planned CLI options:

gren format [INPUTS... | --stdin] [--yes] [--validate]
  • INPUTS: zero or more files to format, or directories to recursively search for gren files to format. If none are given, use the directories implied by gren.json
  • --stdin: instead of formatting files, read stdin and format it to stdout
  • --yes: don't prompt for confirmation before formatting files and overwriting them (does nothing with --stdin)
  • --validate: Don't modify files, and exit 0 if files are all formatted, or exit 1 if some files are not formatted. Intended for use on CI.

Activity

  1. mbartlett21 commented on Feb 18, 2023

    @mbartlett21
    Contributor

    Can there be an argument to choose what line endings to use or whether to keep the existing line endings?

  2. robinheghan commented on Feb 18, 2023

    @robinheghan
    Member

    Maybe. What's your use case?

  3. mbartlett21 commented on Feb 18, 2023

    @mbartlett21
    Contributor

    I'm on Windows, and it is replacing the CRLF line endings with just LF.

    Even if it just kept the same line endings or used CRLF on Windows would be helpful.

  4. robinheghan commented on Feb 23, 2023

    @robinheghan
    Member

    @mbartlett21 Would you mind opening a new issue for using existing line endings when formatting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    formattingIssue is related to `gren format`

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions