Slide 1

Slide 1 text

1 Clime Clime Mosky Mosky

Slide 2

Slide 2 text

2 CLI-ize ME CLI-ize ME It is what the name means! It is what the name means!

Slide 3

Slide 3 text

3 Writing A CLI program Writing A CLI program ● It is not difficult with a library. (ex. argparse) ● But it is annoying, especially for the simple tasks.

Slide 4

Slide 4 text

4 At one midnight ... At one midnight ... I was thinking about the schema of the database. ● initdb.py ● cleardb.py ● dropdb.py ... ● db.py init ● db.py clear ● db.py drop ...

Slide 5

Slide 5 text

5 I opened the doc of I opened the doc of argparse argparse, ,

Slide 6

Slide 6 text

6 then felt sleepy … then felt sleepy …

Slide 7

Slide 7 text

7 It shouldn't be long! It shouldn't be long! # file: db.py def init(): pass def clear(): pass def drop(): pass if __name__ == '__main__': import sys locals()[sys.argv[1]]()

Slide 8

Slide 8 text

8 But human wants are unlimited! But human wants are unlimited!

Slide 9

Slide 9 text

9 After hardworking, After hardworking,

Slide 10

Slide 10 text

10 Clime was released. Clime was released.

Slide 11

Slide 11 text

11 It converts your program 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)

Slide 12

Slide 12 text

12 into a CLI program into a CLI program $ python pyramid.py --help usage: [--squash] or: draw [--squash] $ python pyramid.py –-squash=5 3 * *********** *********************

Slide 13

Slide 13 text

13 just by adding this line: just by adding this line: import clime.now

Slide 14

Slide 14 text

14 If you like it, If you like it,

Slide 15

Slide 15 text

15 $ sudo pip install clime $ sudo pip install clime

Slide 16

Slide 16 text

16 It also supported aliases It also supported aliases … def draw(story, squash=1): '''It draws a pyramid. -s, --squash It is optional. ''' …

Slide 17

Slide 17 text

17 and metavars. and metavars. … def draw(story, squash=1): '''It draws a pyramid. -s , --squash= ''' …

Slide 18

Slide 18 text

18 It is also an executable module. It is also an executable module. $ python -m clime math usage: acos or: acosh or: asin or: asinh or: atan …

Slide 19

Slide 19 text

19 http://clime.mosky.tw/ http://clime.mosky.tw/ is the documentation of Clime. is the documentation of Clime.

Slide 20

Slide 20 text

20 The End The End 1. Zero configuration 2. Auto-generates usage 3. Supports aliases and metavars 4.sudo pip install clime 5. http://clime.mosky.tw/