diff --git a/Makefile b/Makefile index 8c939f54..76ff05fa 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,9 @@ LAST_TAG_VERSION=$(shell git describe --abbrev=0 --tags | sed "s/^v//") bench: rustup run nightly cargo bench --features bench run: - cargo run -- --debug --lint ./ + cargo run -- --lint run\:json: - cargo run -- --lint --format json ./ + cargo run -- --lint --format json build: cargo build --release --target aarch64-apple-darwin sudo ln -f target/aarch64-apple-darwin/release/autocorrect /usr/local/bin/autocorrect @@ -14,7 +14,7 @@ test: @cargo test --manifest-path autocorrect/Cargo.toml @cargo test test\:lint: - @cargo run -q -- --debug --lint tests/fixtures/*.fixed.* + @cargo run -q -- --lint tests/fixtures/*.fixed.* test\:bench: tests/bench.sh test\:lint-json: diff --git a/README.md b/README.md index 44b2b7c2..bb7d2645 100644 --- a/README.md +++ b/README.md @@ -47,26 +47,28 @@ $ curl -sSL https://git.io/JcGER | bash after that, you will get `/usr/local/bin/autocorrect` command. ```bash -AutoCorrect 1.0.0 +AutoCorrect Jason Lee Directly use set file type [default: ] --format Choose an output formatter. [default: diff] [possible values: json, diff] + --threads Number of threads, 0 - use number of CPU [default: 0] ARGS: - ... Target filepath or dir for format + ... Target filepath or dir for format [default: .] ``` ## Usage @@ -86,7 +88,7 @@ $ autocorrect text.txt $ autocorrect --fix text.txt $ autocorrect --fix zh-CN.yml -$ autocorrect --fix ./ +$ autocorrect --fix ``` #### Lint @@ -106,7 +108,7 @@ $ autocorrect --lint text.txt You also can lint multiple files: ```bash -$ autocorrect --lint . +$ autocorrect --lint ``` ### Ignore option @@ -172,7 +174,7 @@ autocorrect: stage: build image: huacnlee/autocorrect:latest script: - - autocorrect --lint . + - autocorrect --lint # Enable allow_failure if you wants. # allow_failure: true ``` diff --git a/autocorrect-cli/src/main.rs b/autocorrect-cli/src/main.rs index 4f575203..402a73fe 100644 --- a/autocorrect-cli/src/main.rs +++ b/autocorrect-cli/src/main.rs @@ -26,25 +26,25 @@ fn get_matches<'a>() -> clap::ArgMatches<'a> { .version(crate_version!()) .about("A linter and formatter for help you improve copywriting, to correct spaces, punctuations between CJK (Chinese, Japanese, Korean).") .arg( - Arg::with_name("file").help("Target filepath or dir for format").takes_value(true).required(true).multiple(true) + Arg::with_name("file").help("Target filepath or dir for format").takes_value(true).default_value(".").multiple(true) ) .arg( - Arg::with_name("fix").long("fix").help("Automatically fix problems and rewrite file.").required(false) + Arg::with_name("fix").long("fix").help("Automatically fix problems and rewrite file.") ) .arg( Arg::with_name("lint").long("lint").help("Lint and output problems.") ) .arg( - Arg::with_name("filetype").long("type").help("Directly use set file type").required(false) + Arg::with_name("filetype").long("type").help("Directly use set file type") ) .arg( - Arg::with_name("formatter").long("format").help("Choose an output formatter.").default_value("diff").possible_values(&["json", "diff"]).required(false) + Arg::with_name("formatter").long("format").help("Choose an output formatter.").default_value("diff").possible_values(&["json", "diff"]) ) .arg( Arg::with_name("debug").long("debug").help("Print debug message.") ) .arg( - Arg::with_name("threads").long("threads").help("Number of threads, 0 - use number of CPU").default_value("0").required(false) + Arg::with_name("threads").long("threads").help("Number of threads, 0 - use number of CPU").default_value("0") ) .get_matches(); }