git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. P. <harald.p.@xmart.de> 2018-09-28 14:58:01 +0200
committerH. P. <harald.p.@xmart.de> 2018-09-28 14:58:01 +0200
commit7bb03c0b6d2767733c0c448da1ba08ded1c16aa1 (patch)
tree79cc980295a2c074a156f35c2d0b898a63097060
parent9848fa8568fd25a6da5b60f56d602274d91de730 (diff)
downloadtimewarrior-holidays-7bb03c0b6d2767733c0c448da1ba08ded1c16aa1.tar.bz2
Now correctly parsing args, we're now able to get argument lists
-rwxr-xr-xrefresh30
1 files changed, 16 insertions, 14 deletions
diff --git a/refresh b/refresh
index d568df1..f6b5cc4 100755
--- a/refresh
+++ b/refresh
@@ -109,27 +109,29 @@ def hparse(lines, locode, year):
sys.stdout.flush()
def main(args):
- if args.locale != "" and args.locale != None:
+ if args.locale != [] and args.locale != None:
locode = str(args.locale[0])
else:
- locode = "de-DE"
+ locode = ["de-DE"]
if args.year != None and args.year != []:
year = args.year
else:
now = datetime.now()
- year = datetime.now().year
+ year = [datetime.now().year]
year = unicode(year)
- sys.stdout.write("Fetching holiday data from holidata.net...")
- sys.stdout.flush()
- lines = hfetch(locode, year)
- print(" done.")
- if lines == "":
- print("No lines returned from holidata.net for %s!", locode)
- exit(3)
- sys.stdout.write("Parsing data")
- sys.stdout.flush()
- hparse(lines, locode, year)
- print(" done.")
+ for i in args.locale:
+ for j in args.year:
+ sys.stdout.write("Fetching holiday data from holidata.net... (%s, %s)" % (i, j))
+ sys.stdout.flush()
+ lines = hfetch(unicode(i), unicode(j))
+ print(" done.")
+ if lines == "":
+ print("No lines returned from holidata.net for %s!", locode)
+ exit(3)
+ sys.stdout.write("Parsing data")
+ sys.stdout.flush()
+ hparse(lines, unicode(i), unicode(j))
+ print(" done.")
if __name__ == "__main__":
usage = """See https://holidata.net for details of supported locales and regions."""