Clime is a Python library which lets you convert any module into a multi-command CLI program without any configuration.
It is a short tour of Clime.
The full documentation of Clime: http://clime.mosky.tw/.
Writing A CLI program
● It is not difficult with a library. (ex. argparse)
● But it is annoying,
especially for the simple tasks.
3
At one midnight ...
I was thinking about the schema of the database.
● initdb.py ● db.py init
● cleardb.py ● db.py clear
● dropdb.py ● db.py drop
... ...
4
It converts your program
# file: pyramid.py
def draw(story, squash=1):
ground_len = 1 + (story-1) * squash * 2
for i in range(1, ground_len+1, squash*2):
print ('*'*i).center(ground_len)
11
into a CLI program
$ python pyramid.py --help
usage: [--squash] <story>
or: draw [--squash] <story>
$ python pyramid.py –-squash=5 3
*
***********
*********************
12