8
8
log = logging .getLogger ("badges" )
9
9
10
10
11
+ # ---------- helper functions ----------------- #
11
12
def _validate_color (ctx , param , val ):
12
13
if param .name == "color" and val is not None :
13
14
if not utils .check_html_color (val ):
@@ -29,6 +30,7 @@ def _change_logging(ctx, param, val):
29
30
log .setLevel (logging .DEBUG )
30
31
31
32
33
+ # ---------- command line interface ----------- #
32
34
@click .group
33
35
@click .help_option ("-h" , "--help" )
34
36
@click .version_option (
@@ -132,12 +134,6 @@ def create(text, color, icon_name, icon_file, output, label, output_type, style)
132
134
"""Create a badge. Uses the given options to querry the shield.io API and
133
135
returnes either the URL or the full svg data."""
134
136
135
- if icon_name is not None :
136
- icon = icon_name
137
-
138
- if icon_file is not None :
139
- icon = utils .convert_imagefile (icon_file )
140
-
141
137
if icon_name is not None and icon_file is not None :
142
138
log .warning (
143
139
"you are using both 'icon-name' and 'icon-file', but can only use one! "
@@ -149,6 +145,12 @@ def create(text, color, icon_name, icon_file, output, label, output_type, style)
149
145
"missing 'icon-name', 'icon-file' and 'label', the badge might look wird."
150
146
)
151
147
148
+ if icon_name is not None :
149
+ icon = icon_name
150
+
151
+ if icon_file is not None :
152
+ icon = utils .convert_imagefile (icon_file )
153
+
152
154
try :
153
155
badge = api ._create_badge (text , color , icon , label )
154
156
except errors .BadgeCreationError as e :
0 commit comments