Skip to content

Commit

Permalink
feature: adds 'highlight' option to depcruise-fmt (#676)
Browse files Browse the repository at this point in the history
  • Loading branch information
sverweij authored Oct 16, 2022
1 parent 5d1ea51 commit 6f5a805
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions bin/depcruise-fmt.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ try {
"-R, --reaches <regex>",
"only include modules matching the regex + all modules that can reach it"
)
.option(
"-H, --highlight <regex>",
"mark modules matching the regex as 'highlighted'"
)
.option("-x, --exclude <regex>", "exclude all modules matching the regex")
.option(
"-S, --collapse <regex>",
Expand Down
10 changes: 8 additions & 2 deletions doc/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1222,11 +1222,17 @@ depcruise-fmt -T dot --focus "^src/main" cruise_result.json | dot -T svg > main.
depcruise-fmt -T dot --focus "^src/juggle" cruise_result.json | dot -T svg > juggle.svg
depcruise-fmt -T dot --include-only "^src/the-law" cruise_result.json | dot -T svg > the-law.svg

## or to find dependencies going into or departing from the spelunkme module
## or to find dependencies going into or departing from the spelunk-me module
## and emitting them to stdout:
depcruise-fmt -T text --focus "^src/main/spelunkme\\.ts$" cruise_result.json
depcruise-fmt -T text --focus "^src/main/spelunk-me\\.ts$" cruise_result.json
```

### highlight

The `--highlight` option is also available in case you want to just highlight
modules without filtering them. See the [--highlight](#highlight-highlight-modules)
documentation of the regular depcruise command for more information.

### collapse/ summarize

Summarize or collapse to either a folder depth or (if you're feeling fancy) a regular
Expand Down
1 change: 1 addition & 0 deletions src/cli/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const KNOWN_FMT_OPTIONS = [
"focus",
"focusDepth",
"help",
"highlight",
"includeOnly",
"outputTo",
"outputType",
Expand Down
1 change: 1 addition & 0 deletions src/main/options/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ function normalizeFormatOptions(pFormatOptions) {
lFormatOptions = normalizeFilterOptions(lFormatOptions, [
"exclude",
"focus",
"highlight",
"includeOnly",
"reaches",
]);
Expand Down

0 comments on commit 6f5a805

Please sign in to comment.