Skip to content

Commit

Permalink
Add new command: impact
Browse files Browse the repository at this point in the history
  • Loading branch information
swiftyfinch committed Apr 8, 2024
1 parent 7533dc5 commit 6546743
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 10 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,21 @@ Right now, it supports the following inputs:
> xtree --help

๐ŸŒณ Printing and analyzing trees inย aย handy way.
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ > print โ”‚ * Print a tree with children statistics. โ”‚
โ”‚ > frequency โ”‚ * Calculate a frequency of each node. โ”‚
โ”‚ > parents โ”‚ * Find all parents of nodes. โ”‚
โ”‚ > update โ”‚ * Download and install the latest version. โ”‚
โ”‚ โ”‚ โ”‚
โ”‚ --version โ”‚ * Show the version. โ”‚
โ”‚ --help, -h โ”‚ * Show help information. โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ > print โ”‚ * Print a tree with children statistics. โ”‚
โ”‚ > frequency โ”‚ * Calculate a frequency of each node. โ”‚
โ”‚ > parents โ”‚ * Find all parents of nodes. โ”‚
โ”‚ > impact โ”‚ * Find affected parent nodes and print them out as a tree. โ”‚
โ”‚ > update โ”‚ * Download and install the latest version. โ”‚
โ”‚ โ”‚ โ”‚
โ”‚ --version โ”‚ * Show the version. โ”‚
โ”‚ --help, -h โ”‚ * Show help information. โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
```
- [`print`](docs/commands-help/print.md)
- [`frequency`](docs/commands-help/frequency.md)
- [`parents`](docs/commands-help/parents.md)
- [`impact`](docs/commands-help/impact.md)

<br>

Expand Down
6 changes: 5 additions & 1 deletion Sources/XTree/CLI/Commands/Impact.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ extension XTree {
struct Impact: AsyncParsableCommand {
static var configuration = CommandConfiguration(
commandName: "impact",
abstract: "Find affected parent nodes and print them out as a tree."
abstract: "Find affected parent nodes and print them out as a tree.",
discussion: """
\("Each node can contain:".accent)
\("โ•ฐโ”€ Name".accent) \("height:explicit_children/children".white.secondary) \("info?".tertiary)
"""
)

@OptionGroup
Expand Down
33 changes: 33 additions & 0 deletions docs/commands-help/impact.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
```sh
> xtree impact --help

๐ŸŒณ Find affected parent nodes and print them out as a tree.
Each node can contain:
โ•ฐโ”€ Name height:explicit_children/children info?
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ --input, -i โ”‚ * (require) The path to the suitable file (*.xcodeproj, โ”‚
โ”‚ โ”‚ Podfile.lock, *.yml/*.yaml), which will be the tree โ”‚
โ”‚ โ”‚ input source. โ”‚
โ”‚ --names, -n [] โ”‚ * The names of the nodes that will be the leaves of the โ”‚
โ”‚ โ”‚ tree. โ”‚
โ”‚ --roots, -r [] โ”‚ * Keep only subtrees where the root node contains the โ”‚
โ”‚ โ”‚ passed string with wildcards (*, ?). โ”‚
โ”‚ --contains, -c [] โ”‚ * Keep only the nodes that contain the passed strings with โ”‚
โ”‚ โ”‚ wildcards (*, ?). โ”‚
โ”‚ --except, -e [] โ”‚ * Exclude nodes that contain any of the passed strings โ”‚
โ”‚ โ”‚ with wildcards (*, ?). โ”‚
โ”‚ --depth, -d โ”‚ * Limit the maximum depth of the tree. โ”‚
โ”‚ --sort, -s โ”‚ * Select the sorting method: by name, by number of โ”‚
โ”‚ โ”‚ children or by height. โ”‚
โ”‚ โ”‚ โ”‚
โ”‚ --help, -h โ”‚ * Show help information. โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
```

## Example

```sh
> xtree impact -n Alamofire --input example.yaml
```

<img width="260" src="https://github.com/swiftyfinch/xtree/assets/64660122/de327838-ad62-4427-8e86-e1f00221c17c">

0 comments on commit 6546743

Please sign in to comment.