Skip to content

Commit

Permalink
Allowed to update/ remove addons by name
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Mar 9, 2019
1 parent 1f5ceca commit 40f1391
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CurseBreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def __init__(self):
epilog='Supported URLs: https://www.curseforge.com/wow/addons/<addon_name>, '
'https://www.wowinterface.com/downloads/<addon_name>, ElvUI, ElvUI:Dev')
parser.add_argument('-a', '--add', help='Install add-ons', metavar='URL')
parser.add_argument('-r', '--remove', help='Remove add-ons', metavar='URL')
parser.add_argument('-u', '--update', help='Update add-ons', metavar='URL')
parser.add_argument('-r', '--remove', help='Remove add-ons', metavar='URL/Name')
parser.add_argument('-u', '--update', help='Update add-ons', metavar='URL/Name')
parser.add_argument('-l', '--list', help='Show installed add-ons', action='store_true')

self.args = parser.parse_args()
Expand Down
7 changes: 4 additions & 3 deletions CurseBreaker/Core.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def save(self):

def check_if_installed(self, url):
for addon in self.config['Addons']:
if addon['URL'] == url:
if addon['URL'] == url or addon['Name'] == url:
return addon

def cleanup(self, directories):
Expand Down Expand Up @@ -67,15 +67,16 @@ def del_addon(self, url):
old = self.check_if_installed(url)
if old:
self.cleanup(old['Directories'])
self.config['Addons'][:] = [d for d in self.config['Addons'] if d.get('URL') != url]
self.config['Addons'][:] = [d for d in self.config['Addons'] if d.get('URL') != url
and d.get('Name') != url]
self.save()
return old['Name'], old['InstalledVersion']
return False, False

def update_addon(self, url):
old = self.check_if_installed(url)
if old:
new = self.parse_url(url)
new = self.parse_url(old['URL'])
new.get_current_version()
oldversion = old['InstalledVersion']
if new.currentVersion != old['InstalledVersion']:
Expand Down

0 comments on commit 40f1391

Please sign in to comment.