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.
cargo install --git https://github.com/kgv/cargo-pretty
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)
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]
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"
- comments,
- diff,
- more cli options.
To my grannies: Ann and Rimma and grandpas: Alexander and George.