Skip to content

Commit

Permalink
revisit README, particularly Parameters section
Browse files Browse the repository at this point in the history
  • Loading branch information
lxxxvi committed Oct 25, 2024
1 parent 5d6fbc2 commit 9c8845b
Showing 1 changed file with 48 additions and 11 deletions.
59 changes: 48 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

Finally it orders the configurations **alphabetically** within these groups.

## Example
## Main example

### Input `.rubocop.yml`:

Expand Down Expand Up @@ -84,28 +84,65 @@ gem install ruboclean
## Command synopsis

```shell
ruboclean [path] [--silent] [--preserve-comments] [--preserve-paths] [--verify]
ruboclean [path] \
[--output=/path/to/file.yml] \
[--silent] \
[--preserve-comments] \
[--preserve-paths] \
[--verify]
```

### Parameters

| Parameter | Description |
|:---------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------|
| `path` | Can be a directory that contains a `.rubocop.yml`, or a path to a `.rubocop.yml` directly. Defaults to the current working directory. |
| `--output=[/path/to/output.yml]` | Output path, where the result is written to. Can be either absolute or relative of the current working directory |
| `--silent` | Suppress any output displayed on the screen when executing the command. |
| `--preserve-comments` | Preserves **preceding** comments for each top-level entry in the configuration. Inline comments are **not** preserved. |
| `--preserve-paths` | Skips the path cleanup that are applied against `Include:` and `Exclude:` configuration. |
| `--verify` | Executes in dry-run mode. Exits with 1 if changes are needed, otherwise 0. |
#### `path`

### Examples
Can be a directory that contains a `.rubocop.yml`, or a path to a `.rubocop.yml` directly.
Defaults to the current working directory.

##### Examples

```shell
ruboclean # uses `.rubocop.yml` of current working directory
ruboclean /path/to/dir # uses `.rubocop.yml` of /path/to/dir
ruboclean /path/to/dir/.rubocop.yml
```

#### `--output=/path/to/file.yml`

Output path where the result is written to.
Can be absolute or relative to the current working directory.
`--output=STDOUT` prints it to STDOUT and not to a file.

##### Examples

```shell
ruboclean --output=/absolute/path.yml
ruboclean --output=relative/path.yml # relative to current working directory
ruboclean --output=STDOUT # does not write anything to a file
```

#### `--silent`

Suppress any log output displayed on the screen when executing the command.
It still prints to STDOUT if used in combination with `--output=STDOUT`.

#### `--preserve-comments`

Preserves **preceding** comments for each top-level entry in the configuration.
Inline comments are **not** preserved.

See main example above for explanation.

#### `--preserve-paths`

Skips the path cleanup that are applied against `Include:` and `Exclude:` configurations.

See main example above for explanation.

#### `--verify`

Executes in dry-run mode. Exits with `1` if changes are needed, otherwise `0`.

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
Expand Down

0 comments on commit 9c8845b

Please sign in to comment.