Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
optkeep = True
else:
optkeep = False
addons = self.parse_args(args)
with Progress('{task.completed}/{task.total}', '|', BarColumn(bar_width=None), '|',
auto_refresh=False, console=self.console) as progress:
task = progress.add_task('', total=len(addons))
while not progress.finished:
for addon in addons:
name, version = self.core.del_addon(addon, optkeep)
if name:
self.table.add_row(f'[bold red]Uninstalled[/bold red]',
Text(name, no_wrap=True), Text(version, no_wrap=True))
else:
self.table.add_row(f'[bold black]Not installed[/bold black]',
Text(addon, no_wrap=True), Text('', no_wrap=True))
progress.update(task, advance=1, refresh=True)
self.console.print(self.table)
else:
self.console.print('[green]Usage:[/green]\n\tThis command accepts a space-separated list of addon names or '
'full links as an argument.\n\t[bold white]Flags:[/bold white]\n\t\t[bold white]-k[/bold'
' white] - Keep the addon files after uninstalling.', highlight=False)
update_addon(addon if isinstance(addon, str) else addon['URL'], update, force)
if provider:
source = f' [bold white]{source}[/bold white]'
else:
source = ''
if versionold:
if versionold == versionnew:
if modified:
self.table.add_row(f'[bold red]Modified[/bold red]{source}',
Text(name, no_wrap=True), Text(versionold, no_wrap=True))
else:
if self.core.config['CompactMode'] and compacted > -1:
compacted += 1
else:
self.table.add_row(f'[green]Up-to-date[/green]{source}',
Text(name, no_wrap=True), Text(versionold, no_wrap=True))
else:
if modified or blocked:
self.table.add_row(f'[bold red]Update suppressed[/bold red]{source}',
Text(name, no_wrap=True), Text(versionold, no_wrap=True))
else:
self.table.add_row(f'[yellow]{"Updated" if update else "Update available"}'
f'[/yellow]{source}', Text(name, no_wrap=True),
Text(versionnew, style='yellow', no_wrap=True))
else:
self.table.add_row(f'[bold black]Not installed[/bold black]{source}',
Text(addon, no_wrap=True), Text('', no_wrap=True))
except Exception as e:
exceptions.append(e)
progress.update(task, advance=1 if args else 0.5, refresh=True)
if addline:
self.console.print('')
self.table.add_row(f'[bold red]Modified[/bold red]{source}',
Text(name, no_wrap=True), Text(versionold, no_wrap=True))
else:
if self.core.config['CompactMode'] and compacted > -1:
compacted += 1
else:
self.table.add_row(f'[green]Up-to-date[/green]{source}',
Text(name, no_wrap=True), Text(versionold, no_wrap=True))
else:
if modified or blocked:
self.table.add_row(f'[bold red]Update suppressed[/bold red]{source}',
Text(name, no_wrap=True), Text(versionold, no_wrap=True))
else:
self.table.add_row(f'[yellow]{"Updated" if update else "Update available"}'
f'[/yellow]{source}', Text(name, no_wrap=True),
Text(versionnew, style='yellow', no_wrap=True))
else:
self.table.add_row(f'[bold black]Not installed[/bold black]{source}',
Text(addon, no_wrap=True), Text('', no_wrap=True))
except Exception as e:
exceptions.append(e)
progress.update(task, advance=1 if args else 0.5, refresh=True)
if addline:
self.console.print('')
self.console.print(self.table)
if compacted > 0:
self.console.print(f'Additionally [green]{compacted}[/green] addons are up-to-date.')
if len(addons) == 0:
self.console.print('Apparently there are no addons installed by CurseBreaker.\n'
'Command [green]import[/green] might be used to detect already installed addons.')
if len(exceptions) > 0:
self.handle_exception(exceptions, False)
if self.core.config['CompactMode'] and compacted > -1:
compacted += 1
else:
self.table.add_row(f'[green]Up-to-date[/green]{source}',
Text(name, no_wrap=True), Text(versionold, no_wrap=True))
else:
if modified or blocked:
self.table.add_row(f'[bold red]Update suppressed[/bold red]{source}',
Text(name, no_wrap=True), Text(versionold, no_wrap=True))
else:
self.table.add_row(f'[yellow]{"Updated" if update else "Update available"}'
f'[/yellow]{source}', Text(name, no_wrap=True),
Text(versionnew, style='yellow', no_wrap=True))
else:
self.table.add_row(f'[bold black]Not installed[/bold black]{source}',
Text(addon, no_wrap=True), Text('', no_wrap=True))
except Exception as e:
exceptions.append(e)
progress.update(task, advance=1 if args else 0.5, refresh=True)
if addline:
self.console.print('')
self.console.print(self.table)
if compacted > 0:
self.console.print(f'Additionally [green]{compacted}[/green] addons are up-to-date.')
if len(addons) == 0:
self.console.print('Apparently there are no addons installed by CurseBreaker.\n'
'Command [green]import[/green] might be used to detect already installed addons.')
if len(exceptions) > 0:
self.handle_exception(exceptions, False)
if args:
if args.startswith('-i '):
args = args[3:]
optignore = True
else:
optignore = False
args = re.sub(r'(\w)([ ]+)(\w)', r'\1,\3', args)
addons = [addon.strip() for addon in list(reader([args], skipinitialspace=True))[0]]
with Progress('{task.completed}/{task.total}', '|', BarColumn(bar_width=None), '|',
auto_refresh=False, console=self.console) as progress:
task = progress.add_task('', total=len(addons))
while not progress.finished:
for addon in addons:
installed, name, version = self.core.add_addon(addon, optignore)
if installed:
self.table.add_row('[green]Installed[/green]', Text(name, no_wrap=True),
Text(version, no_wrap=True))
else:
self.table.add_row('[bold black]Already installed[/bold black]',
Text(name, no_wrap=True), Text(version, no_wrap=True))
progress.update(task, advance=1, refresh=True)
self.console.print(self.table)
else:
self.console.print('[green]Usage:[/green]\n\tThis command accepts a space-separated list of links as an arg'
'ument.[bold white]\n\tFlags:[/bold white]\n\t\t[bold white]-i[/bold white] - Disable th'
'e client version check.\n[bold green]Supported URL:[/bold green]\n\thttps://www.cursefo'
'rge.com/wow/addons/\[addon_name] [bold white]|[/bold white] cf:\[addon_name]\n\thttps:/'
'/www.wowinterface.com/downloads/\[addon_name] [bold white]|[/bold white] wowi:\[addon_i'
'd]\n\thttps://www.tukui.org/addons.php?id=\[addon_id] [bold white]|[/bold white] tu:\[a'
'ddon_id]\n\thttps://www.tukui.org/classic-addons.php?id=\[addon_id] [bold white]|[/bold'
' white] tuc:\[addon_id]\n\thttps://github.com/\[username]/\[repository_name] [bold whit'
'e]|[/bold white] gh:\[username]/\[repository_name]\n\tElvUI [bold white]|[/bold white] '
else:
optignore = False
args = re.sub(r'(\w)([ ]+)(\w)', r'\1,\3', args)
addons = [addon.strip() for addon in list(reader([args], skipinitialspace=True))[0]]
with Progress('{task.completed}/{task.total}', '|', BarColumn(bar_width=None), '|',
auto_refresh=False, console=self.console) as progress:
task = progress.add_task('', total=len(addons))
while not progress.finished:
for addon in addons:
installed, name, version = self.core.add_addon(addon, optignore)
if installed:
self.table.add_row('[green]Installed[/green]', Text(name, no_wrap=True),
Text(version, no_wrap=True))
else:
self.table.add_row('[bold black]Already installed[/bold black]',
Text(name, no_wrap=True), Text(version, no_wrap=True))
progress.update(task, advance=1, refresh=True)
self.console.print(self.table)
else:
self.console.print('[green]Usage:[/green]\n\tThis command accepts a space-separated list of links as an arg'
'ument.[bold white]\n\tFlags:[/bold white]\n\t\t[bold white]-i[/bold white] - Disable th'
'e client version check.\n[bold green]Supported URL:[/bold green]\n\thttps://www.cursefo'
'rge.com/wow/addons/\[addon_name] [bold white]|[/bold white] cf:\[addon_name]\n\thttps:/'
'/www.wowinterface.com/downloads/\[addon_name] [bold white]|[/bold white] wowi:\[addon_i'
'd]\n\thttps://www.tukui.org/addons.php?id=\[addon_id] [bold white]|[/bold white] tu:\[a'
'ddon_id]\n\thttps://www.tukui.org/classic-addons.php?id=\[addon_id] [bold white]|[/bold'
' white] tuc:\[addon_id]\n\thttps://github.com/\[username]/\[repository_name] [bold whit'
'e]|[/bold white] gh:\[username]/\[repository_name]\n\tElvUI [bold white]|[/bold white] '
'ElvUI:Dev\n\tTukui\n\tSLE:Dev', highlight=False)