| Conditions | 3 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # SPDX-FileCopyrightText: 2020 Peter Bittner <[email protected]> |
||
| 15 | def build_git_clean_command( |
||
| 16 | ignore_patterns: list[str], |
||
| 17 | dry_run=False, |
||
| 18 | force=False, |
||
| 19 | ) -> list[str]: |
||
| 20 | """ |
||
| 21 | Build the git clean command with appropriate flags. |
||
| 22 | """ |
||
| 23 | exclude = (item for pattern in ignore_patterns for item in ['-e', pattern]) |
||
|
|
|||
| 24 | mode = '-n' if dry_run else '-f' if force else '-i' |
||
| 25 | return ['git', 'clean', '-dx', *exclude, mode] |
||
| 26 | |||
| 45 |