mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
Add git clean functionality
This commit is contained in:
parent
339d2878b4
commit
7aff860390
1 changed files with 28 additions and 0 deletions
28
libs/util.py
28
libs/util.py
|
@ -59,3 +59,31 @@ def install_requirements(
|
|||
args.append(path)
|
||||
|
||||
subprocess.call(args)
|
||||
|
||||
|
||||
def git_clean(remove_directories=False, force=False, dry_run=False, interactive=False, quiet=False, exclude=None,
|
||||
ignore_rules=False, clean_ignored=False, paths=None):
|
||||
command = ['git', 'clean']
|
||||
if remove_directories:
|
||||
command.append('-d')
|
||||
if force:
|
||||
command.append('--force')
|
||||
if interactive:
|
||||
command.append('--interactive')
|
||||
if quiet:
|
||||
command.append('--quiet')
|
||||
if dry_run:
|
||||
command.append('--dry-run')
|
||||
if exclude:
|
||||
command.append('--exclude={pattern}'.format(pattern=exclude))
|
||||
if ignore_rules:
|
||||
command.append('-x')
|
||||
if clean_ignored:
|
||||
command.append('-X')
|
||||
if paths:
|
||||
try:
|
||||
paths = paths.split(' ')
|
||||
except AttributeError:
|
||||
pass
|
||||
command.extend(paths)
|
||||
subprocess.call(command)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue