1- ### ์ค์ต8 ###
2- # ์คํ ๋ช
๋ น์ด: python app/cli8 .py
1+ ### Week1 sample ###
2+ # ์คํ ๋ช
๋ น์ด: python sample/cli-profile_sample .py
33
44# ==========|์ฝ๋ ์ค์ต|========= #
55import click
66import pyfiglet
7+ import time
8+
79from rich .table import Table
810from rich .console import Console
11+ from rich .progress import track
12+ from rich .syntax import Syntax
913
1014@click .command ()
1115def main ():
12- print (click .style (pyfiglet .figlet_format ("HelloPY" , font = "doom" ), fg = "magenta" ))
13- click .echo (click .style (f"Hello, HelloPY World!" , fg = 'magenta' , bg = 'white' , bold = True ))
14- click .echo ("""
16+ console = Console ()
17+
18+ # ์ฝ๋ ์๊ฐํ
19+ code = """print(hellopy)"""
20+ syntax = Syntax (code , "python" , theme = "monokai" , line_numbers = True )
21+
22+ # ์งํ ์ํฉ ์๊ฐํ
23+ for step in track (range (10 ), description = "Loading HelloPY World..." ):
24+ time .sleep (0.3 )
25+
26+ # ํฌ๋กํ์ด ์๋ ์๊ฐ
27+ explain = """
1528โํฌ๋กํ์ด ์๋โ๋ ํ์ด์ฌ์ ๋ฐฐ์ฐ๊ณ , ๋ง๋ค๊ณ , ํจ๊ป ์ฑ์ฅํ๋ ์ฃผ๋์ด ๊ฐ๋ฐ์๋ค์ ์ธ๊ณ๋ฅผ ์์งํฉ๋๋ค.
1629์ด๊ณณ์ โํ์ดโ๋ ๋จ์ํ ๋์ ํธ๊ฐ ์๋, ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ณ ์ธ์์ ์ฐ๊ฒฐํ๋ ค๋ ์ด์ ๊ณผ ๊ฐ๋ฅ์ฑ์ ๋ด๊ณ ์์ฃ .
1730๐ ๋ ๋ชฌํ์ด ๋ง์์์๋ ์ฒ์ ๋ฐฐ์ฐ๋ ์ด๋ค์ ๊ณต๋ถ๊ฐ,
@@ -26,22 +39,26 @@ def main():
2639๐ฅPymon์ด ๋ง๋ ์๋ฌ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด, ๊ฐ ๋ง์์์ ํ์ดํฌ๋ฃจ(Pie Crew)๊ฐ ๋ชจ์์ต๋๋ค.
2740์ด์ , ๋น์ ์ ์ฐจ๋ก์
๋๋ค.
2841๋ถ๊ฝ์ ๋์ด๋ฆฌ๊ณ , ํฌ๋กํ์ด ์๋๋ฅผ ์ง์ผ์ฃผ์ธ์.
29- """ )
42+ """
3043
44+ # Table ํ
3145 table = Table (title = click .style ("HelloPY ํ์ดํฌ๋ฃจ ์๊ฐ" ), style = "purple" )
32-
3346 table .add_column ("๋ ๋ฒจ" , style = "cyan" )
3447 table .add_column ("์บ๋ฆญํฐ๋ช
" , justify = "right" )
3548 table .add_column ("๋ค์ ๋จ๊ณ ์น๊ธ ์กฐ๊ฑด to-do" , justify = "right" )
3649 table .add_column ("์น๊ธ ์กฐ๊ฑด ๋ง์กฑ ์, ๋ณด์" , justify = "right" )
37-
3850 table .add_row ("LV0" , "ํ์ด๋์ฐ" , "์๊ธฐ์๊ฐ ์ฑ๋์ ์๊ธฐ์๊ฐ \n ์จ๋ณด๋ฉ ๋ฌธ์ ์ ๋
\n ๊ฐ์
20๋ถ ์ด์ ์ ์๋ ์น๊ธ" , "โ
๋ชจ๋ ์ฑ๋ ์ ๊ทผ ๊ถํ \n โ
๋ชจ๋ ํ๋ ์ฐธ์ฌ ๊ฐ๋ฅ" )
3951 table .add_row ("LV1" , "๋ ๋ชฌํ์ด" , "SNS ์ฑ๋ ํ๋ก์ฐ ์ธ์ฆ \n ์ฑํ
10ํ, ์ด๋ชจํฐ์ฝ ๋ฐ์ 30ํ ์ด์ \n ํ๋ก์ ํธ ์ฐธ์ฌ 3ํ ์ด์ \n ๋ฐํ 1ํ ์ด์" , "ํ๋ ์ฐธ์ฌ ์๊ฒฉ ํ๋" )
4052 table .add_row ("LV2" , "์ ํํ์ด" , "ํ๋ ์ฐธ์ฌ 1ํ ์ด์ \n ์ฑํ
50ํ, ์ด๋ชจ์ง ๋ฐ์ 100ํ, ๊ฐ์
30์ผ ์ด์" , "๊ตฟ์ฆ ์๋ชจ๊ถ ์ ๊ณต" )
4153 table .add_row ("LV3" , "์ด์ฝํ์ด" , "๋ฆฌ๋ฉ ๊ฒฝํ ๋ณด์ \n ์ฑํ
100ํ, ์ด๋ชจ์ง ๋ฐ์ 200ํ, ๊ฐ์
30์ผ ์ด์" , "๋ฉํ ๋ฏธํ
์ปค๋ฆฌ์ด ์ฝ์นญ" )
4254 table .add_row ("LV4" , "๋ธ๋ฃจ๋ฒ ๋ฆฌํ์ด" , "(์ด์์ง ์ง์ ๋๋ ์ ์ฒญ ๊ธฐ์ค)" , "HelloPY ํฐ์
์ธ \n ์ ์์ ๊ถํ ์ ์ฉ ๋ฐฐ์ง" )
4355
44- console = Console ()
56+ ### CLI ์ถ๋ ฅ
57+ console .print (syntax )
58+ click .echo (click .style (pyfiglet .figlet_format ("HelloPY" , font = "doom" ), fg = "magenta" ))
59+ click .echo (click .style (f"Hello, HelloPY World!" , fg = 'magenta' , bg = 'white' , bold = True ))
60+ console .print (explain )
61+
4562 console .print (table )
4663
4764if __name__ == "__main__" :
0 commit comments