Skip to content

A tool for formatting manifest according to style guidelines

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

kgv/cargo-pretty

Repository files navigation

cargo pretty

Build Status Build Status Crates Docs License

A tool for formatting manifest according to style guidelines.

See style guideline for more.

Work in progress!

Note the 0.* version: it means that the code is very much experimental. You shouldn’t use this crate for any serious project yet.

Install

cargo install --git https://github.com/kgv/cargo-pretty

Usage

USAGE:
    cargo pretty [FLAGS] [OPTIONS] [FILES]...
    cargo pretty <SUBCOMMAND>

ARGS:
    <FILES>...    Sets the manifest files to format [default: Cargo.toml]

FLAGS:
    -b, --backup     Backup any modified files
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
        --config-path <CONFIG_PATH>    Recursively searches the path for the config file [default: ./]
        --output <OUTPUT>              Output type [default: stdout]  [possible values: file, stdout]

SUBCOMMANDS:
    config    Manipulate config
    help      Prints this message or the help of the given subcommand(s)

cargo pretty config

USAGE:
    cargo pretty config [OPTIONS] [TYPE]

ARGS:
    <TYPE>    Config type [default: active]  [possible values: active, default, diff]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
        --config-path <CONFIG_PATH>    Recursively searches the path for the config file [default: ./]
        --format <FORMAT>              Format type [default: toml]  [possible values: json, ron, toml]
        --output <OUTPUT>              Output type [default: stdout]

Settings

Order:

  • "Unordered" - as is,
  • "Alphabetic" - alphabetic order,
  • ["name", "version", "authors"] - enumeration order or else alphabetic order.

Inline:

  • "Auto" - depends on line length.
  • "None" - never inline,
  • 0.. - inline starting at level (0 - always inline).
Examples

for key a

inline = 0:

a = { b = { c = { d = "d", e = "e" } } }

inline = 1:

[a]
b = { c = { d = "d", e = "e" } }

inline = 2:

[a.b]
c = { d = "d", e = "e" }

inline = 3 or more or inline = "None":

[a.b.c]
d = "d"
e = "e"

Todo

  • comments,
  • diff,
  • more cli options.

Dedication

To my grannies: Ann and Rimma and grandpas: Alexander and George.

About

A tool for formatting manifest according to style guidelines

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages