-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.py
More file actions
147 lines (108 loc) · 4.25 KB
/
Copy pathindex.py
File metadata and controls
147 lines (108 loc) · 4.25 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
from package import (
do_news,do_quote,do_movie,do_youtube,do_wallpaper,do_crypto,login,do_insta
)
#app = Flask(__name__)
import cmd
import sys
#flask web
#@app.route("/")
class FirstCmdApplication(cmd.Cmd):
try:
intro = "Welcome {username}!".format(username=sys.argv[1])
except IndexError:
print("Please provide your username!")
#exit()
user = input("Enter username :")
intro = "Welcome {username}!".format(username=user)
from termcolor import colored
intr = """
--------------------------------------------------------------------------------------------------
\t\t\t\t Welcome to Cli Application
\t *.news : for News
\t *.quote : for quote of the day
\t *.wallpaper : to display wallpaper
\t *.youtube video download : download a Video
\t *.movie title_movie : for Movie details
\t *.crypto: for Crypto Currency prices
\t *.login : facebook and instagram login via CMD
\t *.wiki : execute wikipedia search
\t *.exit
\t\t\t\t\t\t\t\t\t for help type help
"""
intri = colored(intr, 'yellow')
print(intri)
prompt = 'Command: '
def do_intro(self,arg):
from termcolor import colored
"display the options"
intr = """
--------------------------------------------------------------------------------------------------
\t\t\t\t Welcome to Cli Application
\t *.news : for News
\t *.quote : for quote of the day
\t *.wallpaper : to display wallpaper
\t *.youtube video download : download a Video
\t *.movie title_movie : for Movie details
\t *.crypto: for Crypto Currency prices
\t *.login : facebook login via CMD
\t *.exit
\t\t\t\t\t\t\t\t\t for help type help
"""
intrc = colored(intr, 'yellow')
print(intrc)
def do_login(self,arg):
"facbook login via selenium"
choice =input("press 1 for facebook login \npress 2 for instagram login\n")
if(choice=='1'):
login()
elif (choice=='2'):
do_insta()
def do_youtube(self,arg):
"youtube video"
do_youtube()
def do_wiki(self,arg):
"execute wikipedia search"
def do_crypto(self,arg):
"crypto currency price"
do_crypto()
def do_history(self, arg):
"not working"
print(self._history)
def do_news(self, arg):
"Read today's news"
do_news()
def do_movie(self,title):
"get movies ratings n info"
do_movie(title)
def do_quote(self, arg):
"Read quote of the day"
do_quote()
def do_wallpaper(self,arg):
"Display Wallpaper"
do_wallpaper()
def do_exit(self, arg):
"Exit the application"
return -1
def precmd(self, line):
""" This method is called after the input but before
it has been interpreted. If you want to modify the input line
before execution (for example, variable substitution) do it here.
"""
if line != '':
self._history += [ line.strip() ]
return line
def postcmd(self, stop, line):
"""If you want to stop the console, return something that evaluates to true.
If you want to do some post command processing, do it here.
"""
return stop
def preloop(self):
"Initialization before prompting user for commands"
cmd.Cmd.preloop(self)
self._history = []
def postloop(self):
"Take care of any unfinished business."
print("Exiting...")
cmd.Cmd.postloop(self)
if __name__=='__main__':
FirstCmdApplication().cmdloop()