-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtimeline-ascii.py
executable file
·45 lines (36 loc) · 1.1 KB
/
timeline-ascii.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python3
#
# timeline-ascii.py
#
# Create an ascii representation of a timeline, given the number of days
# between each event.
#
# You can take a screenshot of the ascii timeline and then scale it to any
# width, quickly giving you an accurate representation of spacing between
# events so you can create a graphical timeline using circles and lines (or
# whatever).
#
# USAGE: ./timeline-ascii.py days1 days2 ... daysN
#
# EXAMPLE: ./timeline-ascii.py 20 6 8 14 2 13 1 7 13 1
# ******************** ------ ******** -------------- ** ------------- * ------- ************* -
#
import sys
import click
@click.command(context_settings=dict(help_option_names=["-h", "-?", "--help"]))
@click.argument('days', nargs=-1)
def main(days):
"""Create an ascii representation of a timeline.
DAYS is a list of days between each event.
EXAMPLE: ./timeline-ascii.py 20 6 8 14 2 13 1 7 13 1
"""
chars = ['*', '-']
char = 0
out = ''
for day in days:
out += chars[char]*int(day)
char = (char+1) % 2
print(out)
pass
if __name__ == "__main__":
main()