0
ClimeMosky        1
CLI-ize MEIt is what the name means!                             2
Writing A CLI program●   It is not difficult with a library. (ex. argparse)●   But it is annoying,    especially for the s...
At one midnight ...I was thinking about the schema of the database.●   initdb.py               ●   db.py init●   cleardb.p...
I opened the doc of argparse,                    argparse,                                5
then felt sleepy …                     6
It shouldnt be long!# file: db.pydef init():    passdef clear():    passdef drop():    passif __name__ == __main__:    imp...
But human wants are unlimited!                                 8
After hardworking,                     9
Clime was released.                      10
It converts your program# file: pyramid.pydef draw(story, squash=1):    ground_len = 1 + (story-1) * squash * 2    for i i...
into a CLI program$ python pyramid.py --helpusage: [--squash] <story>   or: draw [--squash] <story>$ python  pyramid.py –-...
just by adding this line:    import clime.now                            13
If you like it,                  14
$ sudo pip install clime                           15
It also supported aliases…def draw(story, squash=1):    It draws a pyramid.    -s, --squash   It is optional.    …        ...
and metavars.…def draw(story, squash=1):    It draws a pyramid.    -s <int>, --squash=<int>    …                          ...
It is also an executable module.$ python -m clime mathusage: acos <x>   or: acosh <x>   or: asin <x>   or: asinh <x>   or:...
http://clime.mosky.tw/  is the documentation of Clime.                                   19
The End1. Zero configuration2. Auto-generates usage3. Supports aliases and metavars4. sudo pip install clime5. http://clim...
Upcoming SlideShare
Loading in...5
×

Introduction to Clime

4,097

Published on

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/.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,097
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
5
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Introduction to Clime"

  1. 1. ClimeMosky 1
  2. 2. CLI-ize MEIt is what the name means! 2
  3. 3. Writing A CLI program● It is not difficult with a library. (ex. argparse)● But it is annoying, especially for the simple tasks. 3
  4. 4. 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
  5. 5. I opened the doc of argparse, argparse, 5
  6. 6. then felt sleepy … 6
  7. 7. It shouldnt be long!# file: db.pydef init(): passdef clear(): passdef drop(): passif __name__ == __main__: import sys locals()[sys.argv[1]]() 7
  8. 8. But human wants are unlimited! 8
  9. 9. After hardworking, 9
  10. 10. Clime was released. 10
  11. 11. It converts your program# file: pyramid.pydef 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
  12. 12. into a CLI program$ python pyramid.py --helpusage: [--squash] <story> or: draw [--squash] <story>$ python pyramid.py –-squash=5 3 * ******************************** 12
  13. 13. just by adding this line: import clime.now 13
  14. 14. If you like it, 14
  15. 15. $ sudo pip install clime 15
  16. 16. It also supported aliases…def draw(story, squash=1): It draws a pyramid. -s, --squash It is optional. … 16
  17. 17. and metavars.…def draw(story, squash=1): It draws a pyramid. -s <int>, --squash=<int> … 17
  18. 18. It is also an executable module.$ python -m clime mathusage: acos <x> or: acosh <x> or: asin <x> or: asinh <x> or: atan <x>… 18
  19. 19. http://clime.mosky.tw/ is the documentation of Clime. 19
  20. 20. The End1. Zero configuration2. Auto-generates usage3. Supports aliases and metavars4. sudo pip install clime5. http://clime.mosky.tw/ 20
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×