Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Armin Becher committed Jun 24, 2020
1 parent 610cbc6 commit 983a3ad
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 28 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ Types for Changes:
## [0.9.2] - 2020-05-24

## [0.9.1] - 2020-01-29
### Fixed

* Mailto URI path accepted without double shlases
### Fixed

* Mailto URI path accepted without double slashes

## [0.9.0] - 2020-01-20

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Armin Becher
Copyright (c) 2020 Armin Becher

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,46 @@ Check for broken links in markup files. Currently `html` and `markdown` files ar

## Install

There are different ways to install and use mlc.
There are different ways to install and use *mlc*.

### Cargo

Use rust's package manager [cargo](https://doc.rust-lang.org/cargo/) to install mlc from [crates.io](https://crates.io/crates/mlc):
Use rust's package manager [cargo](https://doc.rust-lang.org/cargo/) to install *mlc* from [crates.io](https://crates.io/crates/mlc):

``` bash
cargo install mlc
```

### Download Binaries

To download a compiled binary version of mlc go to [github releases](https://github.com/becheran/mlc/releases) and download the binaries compiled for `x86_64-unknown-linux-gnu`.
To download a compiled binary version of *mlc* go to [github releases](https://github.com/becheran/mlc/releases) and download the binaries compiled for `x86_64-unknown-linux-gnu`.

### CI/CD Pipeline Integration

To integrate mlc in your CI pipeline running in a linux x86_64 environment you can add the following commands to download mlc:
To integrate *mlc* in your CI pipeline running in a *linux x86_64 environment* you can add the following commands to download the tool:

``` bash
curl -L https://github.com/becheran/mlc/releases/download/v0.9.2/mlc -o mlc
chmod +x mlc
```

For example take a look at the [ntest repo](https://github.com/becheran/ntest) which uses mlc in the CI pipeline.
For example take a look at the [ntest repo](https://github.com/becheran/ntest/blob/master/.gitlab-ci.yml) which uses *mlc* in the CI pipeline.

## Usage

Once you have mlc installed it canned just be called from the command line. The following call will check all links in markup files found in the current folder and all subdirectories:
Once you have *mlc* installed, it can be called from the command line. The following call will check all links in markup files found in the current folder and all subdirectories:

``` bash
mlc
```

Another example would be to call mlc on a certain directory or file:
Another example is to call *mlc* on a certain directory or file:

``` bash
mlc ./docs
```

Call mlc with the `--help` flag to display all available cli arguments:
Call *mlc* with the `--help` flag to display all available cli arguments:

``` bash
mlc -h
Expand All @@ -64,4 +64,4 @@ Checkout the [changelog file](https://github.com/becheran/mlc/blob/master/CHANGE

## License

This project is licensed under the MIT License - see the [LICENSE file](https://github.com/becheran/mlc/blob/master/LICENSE) for details.
This project is licensed under the *MIT License* - see the [LICENSE file](https://github.com/becheran/mlc/blob/master/LICENSE) for more details.
2 changes: 1 addition & 1 deletion docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
| `--debug` | `-d` | Show verbose debug information |
| `--no-web-links` | | Do not check any web links |
| `--version` | `-V` | Print current version of mlc |
| `--ignore-links` | | List of links which shall be ignored. Use simple `?` and `*` wildcards. For example `--ignore-links "http*://crates.io*"` will skipp all links to the crates.io website. See the [used lib](https://github.com/becheran/wildmatch) for more information. |
| `--ignore-links` | | List of links which shall be ignored. Use simple `?` and `*` wildcards. For example `--ignore-links "http*://crates.io*"` will skip all links to the crates.io website. See the [used lib](https://github.com/becheran/wildmatch) for more information. |
| `--markup-types` | `-t` | List of markup types which shall be checked [possible values: md, html] |
| `<directory>` | | Path to directory which shall be checked with all sub-dirs. Can also be a specific filename which shall be checked. |
6 changes: 3 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub fn parse_args() -> Config {
let matches = App::new(crate_name!())
.arg(
Arg::with_name("directory")
.help("Check all links in given folder and subfolders")
.help("Check all links in given directory and subdirectory")
.required(false)
.index(1),
)
Expand Down Expand Up @@ -51,7 +51,7 @@ pub fn parse_args() -> Config {
} else {
logger::LogLevel::Warn
};
let folder = matches
let directory = matches
.value_of("directory")
.unwrap_or("./")
.parse()
Expand All @@ -71,7 +71,7 @@ pub fn parse_args() -> Config {

Config {
log_level,
folder: folder,
folder: directory,
markup_types,
no_web_links,
ignore_links,
Expand Down
22 changes: 10 additions & 12 deletions src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,25 @@ arg_enum! {
}
}


impl Default for LogLevel {
fn default() -> Self { LogLevel::Warn }
fn default() -> Self {
LogLevel::Warn
}
}

pub fn init(log_level: &LogLevel) {
let level_filter =
match log_level {
LogLevel::Info => LevelFilter::Info,
LogLevel::Warn => LevelFilter::Warn,
LogLevel::Debug => LevelFilter::Debug,
};
let level_filter = match log_level {
LogLevel::Info => LevelFilter::Info,
LogLevel::Warn => LevelFilter::Warn,
LogLevel::Debug => LevelFilter::Debug,
};

let mut logger_array = vec![];
match TermLogger::new(level_filter,
Config::default(),
TerminalMode::Mixed) {
match TermLogger::new(level_filter, Config::default(), TerminalMode::Mixed) {
Some(logger) => logger_array.push(logger as Box<dyn SharedLogger>),
None => logger_array.push(SimpleLogger::new(level_filter, Config::default())),
}

CombinedLogger::init(logger_array).expect("No logger should be already set");
debug!("Initialized logging")
}
}

0 comments on commit 983a3ad

Please sign in to comment.