Skip to content

Commit

Permalink
add verbose messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-hamlin committed Feb 16, 2020
1 parent c5d6b5e commit f175926
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## 1.1.0

- Added -bom check flag to fix/work around issues where the BOM causes files to fail.
- Added the -v/--verbose flag to print out all the files touched.
- Added the --verbose flag to print out all the files touched.
- Enabled arbitrary_precision in serde_json to keep large numbers intact when changing file.

## 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ cargo install pitufo
## Usage

```console
Usage: pitufo [--follow] [--minify] [--bom] [-m <max-depth>] -p <path>

usage of pitufo
Usage: pitufo [--follow] [--verbose] [--minify] [--bom] [-m <max-depth>] -p <path>

Options:
--follow follow symbolic links, the default is to not follow.
--verbose verbose mode, output the path of every file found, defaults
to silent
--minify minify the json, the default is to prettify.
--bom look for leading BOM in json files and remove if found, the
default is to take the file as-is.
-m, --max-depth set the maximum depth to recurse
-p, --path the path to search for json fi
-p, --path the path to search for json files.
--help display usage information
```

## Example
Expand Down
7 changes: 7 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ pub struct Opts {
#[argh(switch, long = "follow")]
follow_links: bool,

/// verbose mode, output the path of every file found,
/// defaults to silent
#[argh(switch)]
verbose: bool,

/// minify the json, the default is to prettify.
#[argh(switch)]
minify: bool,
Expand Down Expand Up @@ -45,6 +50,8 @@ fn main() {
{
if let Err(e) = process_file(&entry, options.minify, options.bom) {
eprintln!("error {} {}", e, entry.path().display());
} else if options.verbose {
println!("{}", entry.path().display());
}
}
}
Expand Down

0 comments on commit f175926

Please sign in to comment.