Skip to content

Commit

Permalink
Implement ConsoleTool.clear_account()
Browse files Browse the repository at this point in the history
  • Loading branch information
ppolewicz committed Jan 4, 2016
1 parent 2019ac0 commit c3050f0
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions b2
Original file line number Diff line number Diff line change
Expand Up @@ -780,13 +780,6 @@ def post_file(url, headers, file_path, exit_on_error=True, progress_bar=False):
return json.loads(json_text)


def clear_account(args):
if len(args) != 0:
usage_and_exit()
info = StoredAccountInfo()
info.clear()


def url_for_api(info, api_name):
if api_name in ['b2_download_file_by_id']:
base = info.get_download_url()
Expand Down Expand Up @@ -1320,6 +1313,11 @@ class ConsoleTool(object):

print self.api.make_url(file_id)

def clear_account(self, args):
if len(args) != 0:
usage_and_exit()
self.api.account_info.clear()

@property
def info(self): # TODO: this is only temporary, remove it
return self.api.account_info
Expand All @@ -1339,7 +1337,7 @@ def main():
if action == 'authorize_account':
authorize_account(args)
elif action == 'clear_account':
clear_account(args)
ct.clear_account(args)
elif action == 'create_bucket':
ct.create_bucket(args)
elif action == 'delete_bucket':
Expand Down Expand Up @@ -1367,7 +1365,7 @@ def main():
elif action == 'update_bucket':
ct.update_bucket(args)
elif action == 'upload_file':
upload_file(args)
ct.upload_file(args)
elif action == 'version':
print 'b2 command line tool, version', VERSION
else:
Expand Down

0 comments on commit c3050f0

Please sign in to comment.