Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions date_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
__author__ = 'Jake Miller (@LaconicWolf)'
__date__ = '20190316'
__version__ = '0.01'
__description__ = """Creates a rule file that will append digits that may
__description__ = """Creates a rule file that will append digits that may
map to dates in popular formats that may be appended to files. You can also
append or prepend characters or words, capitalize the first character of the
append or prepend characters or words, capitalize the first character of the
words, and double the word. Dates are currently MDY, but can be DMY or YMD"""

import argparse
Expand Down Expand Up @@ -134,20 +134,20 @@ def main():
# 19000101-20991231
four_dig_year_month_day = create_4_dig_year_month_day(start_year, end_year)

all_dates = two_dig_year
all_dates = two_dig_year
if date_time_format == 'MDY':
all_dates += month_day
all_dates += month_day_2_dig_year
all_dates += month_day_4_dig_year
all_dates += month_day
all_dates += month_day_2_dig_year
all_dates += month_day_4_dig_year

if date_time_format == 'YMD':
all_dates += month_day
all_dates += two_dig_year_month_day
all_dates += two_dig_year_month_day
all_dates += four_dig_year_month_day

if date_time_format == 'DMY':
all_dates += month_day
all_dates += two_dig_year_month_day
all_dates += two_dig_year_month_day
all_dates += four_dig_year_month_day

# Write to rule file
Expand Down Expand Up @@ -189,7 +189,7 @@ def main():
fh.write('d${}${}c\n'.format('$'.join(list(date)), '$'.join(list(item))))

if prepensions:
for item in appensions:
for item in prepensions:
# Writes items with dates
fh.write('^{}${}\n'.format('^'.join(list(item)[::-1]), '$'.join(list(date)) ))

Expand Down