Skip to content

Commit

Permalink
Simplify param processing
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio committed Mar 18, 2022
1 parent 70dae85 commit 8ce5f0d
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions shub/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,17 +786,9 @@ def _update_conf_file(filename, target, project, repository):
click.echo("Saved to %s." % filename)


class _BooleanOrStringParamType(ParamType):
class _AnyParamType(ParamType):

def convert(self, value, param, ctx):
if isinstance(value, bool):
return value
value = str(value)
lowercase_value = value.lower()
if lowercase_value == 'true':
return True
if lowercase_value == 'false':
return False
return value


Expand Down Expand Up @@ -845,6 +837,6 @@ def create_scrapinghub_yml_wizard(conf, target='default', image=None):
if image or (image is None and _detect_custom_image_project()):
repository = click.prompt(
"Image repository (leave empty to use Scrapinghub's repository)",
default=True, show_default=False, type=_BooleanOrStringParamType())
default=True, show_default=False, type=_AnyParamType())
_update_conf(conf, target, project, repository)
_update_conf_file(closest_sh_yml, target, project, repository)

0 comments on commit 8ce5f0d

Please sign in to comment.