Skip to content

Commit

Permalink
Fixed handling addons with comma in name (close #45)
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Feb 1, 2020
1 parent 36ac80a commit 2cc7478
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CB/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import string
import random

__version__ = '3.1.4'
__version__ = '3.1.5'
__license__ = 'GPLv3'
__copyright__ = '2019-2020, Paweł Jastrzębski <[email protected]>'
__docformat__ = 'restructuredtext en'
Expand Down
12 changes: 7 additions & 5 deletions CurseBreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import requests
import platform
import traceback
from csv import reader
from tqdm import tqdm
from pathlib import Path
from terminaltables import SingleTable
Expand Down Expand Up @@ -245,8 +246,9 @@ def setup_completer(self):
'uri_integration', 'help', 'exit']
addons = sorted(self.core.config['Addons'], key=lambda k: k['Name'].lower())
for addon in addons:
commands.extend([f'uninstall {addon["Name"]}', f'update {addon["Name"]}', f'force_update {addon["Name"]}',
f'toggle_dev {addon["Name"]}', f'status {addon["Name"]}'])
name = f'"{addon["Name"]}"' if ',' in addon["Name"] else addon["Name"]
commands.extend([f'uninstall {name}', f'update {name}', f'force_update {name}', f'toggle_dev {name}',
f'status {name}'])
for item in self.cfSlugs:
commands.append(f'install cf:{item}')
for item in self.wowiSlugs:
Expand Down Expand Up @@ -278,7 +280,7 @@ def c_install(self, args):
optignore = True
else:
optignore = False
addons = [addon.strip() for addon in args.split(',')]
addons = [addon.strip() for addon in list(reader([args], skipinitialspace=True))[0]]
with tqdm(total=len(addons), bar_format='{n_fmt}/{total_fmt} |{bar}|') as pbar:
for addon in addons:
installed, name, version = self.core.add_addon(addon, optignore)
Expand All @@ -301,7 +303,7 @@ def c_install(self, args):

def c_uninstall(self, args):
if args:
addons = [addon.strip() for addon in args.split(',')]
addons = [addon.strip() for addon in list(reader([args], skipinitialspace=True))[0]]
with tqdm(total=len(addons), bar_format='{n_fmt}/{total_fmt} |{bar}|') as pbar:
for addon in addons:
name, version = self.core.del_addon(addon)
Expand All @@ -326,7 +328,7 @@ def c_update(self, args, addline=False, update=True, force=False):
self.core.cfCache = {}
self.core.wowiCache = {}
if args:
addons = [addon.strip() for addon in args.split(',')]
addons = [addon.strip() for addon in list(reader([args], skipinitialspace=True))[0]]
else:
addons = sorted(self.core.config['Addons'], key=lambda k: k['Name'].lower())
self.core.bulk_check(addons)
Expand Down

0 comments on commit 2cc7478

Please sign in to comment.