Skip to content

Commit

Permalink
Output full value (till next delimiter) as flag.
Browse files Browse the repository at this point in the history
Signed-off-by: Kurt Garloff <kurt@garloff.de>
  • Loading branch information
garloff committed Dec 18, 2023
1 parent 624da3a commit e7b082d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Tests/iaas/flavor-naming/flavor-form.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ def keystr(key):
return key


def flagstr(fstr):
"Return string fstr till next delimiter %_-"
for i in range(0, len(fstr)):
if fstr[i] == "_" or fstr[i] == "-" or fstr[i] == "%":
return fstr[:i]
return fstr


def find_letter(idx, outstr):
"Find letter in output template outstr with idx i that indicates a flag"
found = 0
Expand All @@ -171,7 +179,7 @@ def find_letter(idx, outstr):
if ltr == '%':
if idx == found:
if outstr[ltri+1] == '?':
return outstr[ltri+2]
return flagstr(outstr[ltri+2:])
else:
found += 1
return ""
Expand Down

0 comments on commit e7b082d

Please sign in to comment.