Skip to content

Commit

Permalink
[CLI] Fix wrong use of arguments
Browse files Browse the repository at this point in the history
The previous change removed undefined arguments from the args dict,
don't try to use possibly missing arguments without a fallback value.
  • Loading branch information
Gauvain Pocentek committed Dec 25, 2016
1 parent f4fcf45 commit b05c0b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gitlab/cli.py
Expand Up @@ -181,7 +181,7 @@ def do_project_search(self, cls, gl, what, args):

def do_project_all(self, cls, gl, what, args):
try:
return gl.projects.all(all=args['all'])
return gl.projects.all(all=args.get('all', False))
except Exception as e:
_die("Impossible to list all projects", e)

Expand Down Expand Up @@ -333,10 +333,10 @@ def do_project_merge_request_cancel(self, cls, gl, what, args):
def do_project_merge_request_merge(self, cls, gl, what, args):
try:
o = self.do_get(cls, gl, what, args)
should_remove = args['should_remove_source_branch']
build_succeeds = args['merged_when_build_succeeds']
should_remove = args.get('should_remove_source_branch', False)
build_succeeds = args.get('merged_when_build_succeeds', False)
return o.merge(
merge_commit_message=args['merge_commit_message'],
merge_commit_message=args.get('merge_commit_message', ''),
should_remove_source_branch=should_remove,
merged_when_build_succeeds=build_succeeds)
except Exception as e:
Expand Down

0 comments on commit b05c0b6

Please sign in to comment.