Update clap dependencies and add the derive feature.
Adapt the Clap::app into a client using derivative features.
Slight workflow enhancement for the --keep option (only keep the file when the option is provided)
Slight change of behavior when creating a Cargo.toml.new or Cargo.toml.bak files (see below)
Update README
Add crates.io badge
Update the help output
[!NOTE]
The command behavior is left unchanged
Before
$ cargo run -- --help
Formatting Cargo.toml
Usage: cargo-tomlfmt [OPTIONS] [COMMAND]
Commands:
tomlfmt It's just an alias as a subcommand of cargo.
help Print this message or the help of the given subcommand(s)
Options:
-p, --path <path> Path to the manifest. (default is Cargo.toml)
-d, --dryrun Do NOT overwrite the file.
-k, --keep Keep the original manifest as Cargo.toml.bak.
-c, --create Create a formatted manifest as Cargo.toml.new when dryrun.
-h, --help Print help
-V, --version Print version
Now
$ cargo run -- --help
Usage: cargo-tomlfmt [OPTIONS] [COMMAND]
Commands:
tomlfmt Just an alias as a subcommand of cargo
help Print this message or the help of the given subcommand(s)
Options:
-p, --path <PATH> Path to the manifest [default: Cargo.toml]
-d, --dryrun Do NOT overwrite the file
-k, --keep Keep the original manifest as Cargo.toml.bak
-c, --create Create a formatted manifest as Cargo.toml.new when dryrun
-h, --help Print help
-V, --version Print version
Create and Keep options behavior
Before
$ cargo tomlfmt -k -p sub_dir/Cargo.toml
$ ls sub_dir/Cargo.toml.bak
ls: cannot access 'sub_dir/Cargo.toml.bak': No such file or directory
$ ls Cargo.toml.bak # The backup file has changed folder
Cargo.toml.bak
Now
$ cargo tomlfmt -k -p sub_dir/Cargo.toml
$ ls sub_dir/Cargo.toml.bak # The backup file has the right path
sub_dir/Cargo.toml.bak
The follow-up to this PR https://github.com/tbrand/cargo-tomlfmt/pull/22.
What is done:
clap
dependencies and add thederive
feature.Clap::app
into a client using derivative features.--keep
option (only keep the file when the option is provided)Cargo.toml.new
orCargo.toml.bak
files (see below)Before
Now
Create and Keep options behavior
Before
Now