forked from yoda-pa/yoda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyoda.py
265 lines (234 loc) · 6.99 KB
/
yoda.py
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
import os
import sys
import click
from modules import *
sys.path.insert(1, os.getcwd())
@click.group(cls=alias.Alias)
@click.pass_context
def cli(ctx):
"""
Yoda PA: A personal assistant based on the command line
"""
# The alias module
cli.add_command(alias.alias)
@cli.command()
@click.pass_context
@click.argument('input', nargs=-1, required=False, callback=alias.alias_checker)
def chat(ctx, input):
"""
A simple chatbot\n
To use, type: yoda chat <message>
"""
input = util.get_arguments(ctx, -1)
if input:
test_string = ''
for i in input:
test_string += i + ' '
data = sys.modules['modules.chat'].process(test_string)
else:
click.echo('No input specified. Run with --help for info')
# The devtools module
cli.add_command(dev.dev)
cli.add_command(dev.speedtest)
cli.add_command(dev.url)
cli.add_command(dev.hackernews)
cli.add_command(dev.coinflip)
cli.add_command(dev.iplookup)
cli.add_command(dev.checksite)
cli.add_command(dev.horoscope)
cli.add_command(dev.mp3cutter)
cli.add_command(dev.whois)
cli.add_command(dev.fileshare)
cli.add_command(dev.run)
cli.add_command(dev.keybindings)
@cli.command()
@click.pass_context
@click.argument('input', nargs=-1, required=False, callback=alias.alias_checker)
def love(ctx, input):
"""
maintain a profile of someone you love\n
commands:\n
setup: Setup love\n
status: check love status\n
note: Add a note\n
notes: View notes\n
like: Add things they like\n
likes: View things they like\n
addbirth: Add birthday\n
showbirth: Show birthday\n
"""
input = util.get_arguments(ctx, -1)
if input:
test_string = ''
for i in input:
test_string += (i + ' ')
data = sys.modules['modules.love'].process(test_string)
else:
click.echo('No input specified. Run with --help for info')
@cli.command()
@click.pass_context
@click.argument('input', nargs=-1, required=False, callback=alias.alias_checker)
def people(ctx, input):
"""
maintain a profile of someone your Friend\n
commands:\n
setup: Setup Friend\n
status: check Friend status\n
note: Add a note\n
notes: View notes\n
like: Add things they like\n
likes: View things they like\n
"""
input = util.get_arguments(ctx, -1)
if input:
test_string = ''
for i in input:
test_string += (i + ' ')
data = sys.modules['modules.people'].process(test_string)
else:
click.echo('No input specified. Run with --help for info')
@cli.command()
@click.pass_context
@click.argument('input', nargs=-1, required=False, callback=alias.alias_checker)
def diary(ctx, input):
"""
Maintain a personal diary\n
roughly based on the concept of Bullet Journal (http://bulletjournal.com/) \n\n
Commands:\n
nn: New note\n
nt: new Task\n
dt: delete task\n
notes: view all notes\n
ut: update task\n
un: update note\n
dct: delete all completed tasks\n
dn:delete particular note\n
tasks: view all completed and incomplete tasks\n
ct: complete task
"""
input = util.get_arguments(ctx, -1)
if input:
test_string = ''
for i in input:
test_string += (i + ' ')
data = sys.modules['modules.diary'].process(test_string)
else:
click.echo('No input specified. Run with --help for info')
@cli.command()
@click.pass_context
@click.argument('input', nargs=-1, required=False, callback=alias.alias_checker)
def money(ctx, input):
"""
For tracking money \n\n
Commands:\n
setup: set a profile with default currency and initial money\n
status: check config\n
exp: add an expense\n
exps: view all expenses\n
convert: Convert from one currency to other\n
"""
input = util.get_arguments(ctx, -1)
if input:
test_string = ''
for i in input:
test_string += (i + ' ')
data = sys.modules['modules.money'].process(test_string)
else:
click.echo('No input specified. Run with --help for info')
# The food module
cli.add_command(food.food)
# The learn module
cli.add_command(learn.learn)
cli.add_command(learn.vocabulary)
cli.add_command(learn.flashcards)
cli.add_command(learn.dictionary)
# The entertainment module
cli.add_command(entertainment.lyrics)
@cli.command()
@click.pass_context
@click.argument('input', nargs=-1, required=False, callback=alias.alias_checker)
def setup(ctx, input):
"""
create a setup configuration for you to save some information locally
"""
input = util.get_arguments(ctx, -1)
if input:
test_string = ''
for i in input:
test_string += (i + ' ')
data = sys.modules['modules.setup'].process(test_string)
else:
click.echo('No input specified. Run with --help for info')
# feedback
@cli.command()
def feedback():
"""
Provide feedback for this package by:\n
- Reporting a bug
- Suggesting a feature
- General suggestion
"""
click.echo('For:\n\
1. reporting a bug\n\
2. For suggesting a feature\n\
3. Any general suggestion or question\n\
Please create an issue in the Github repository:\nhttps://github.com/yoda-pa/yoda/issues/new')
# the life module
cli.add_command(life.rlist)
cli.add_command(life.ideas)
@cli.command()
@click.pass_context
@click.argument('input', nargs=-1, required=False, callback=alias.alias_checker)
def goals(ctx, input):
"""
Set your goals \n\n
Commands:\n
new: New goal\n
view: View all completed and incomplete goals\n
tasks: View tasks related to the goal\n
complete: Complete a goal\n
analyze: Analyze goals\n
"""
input = util.get_arguments(ctx, -1)
if input:
test_string = ''
for i in input:
test_string += (i + ' ')
data = sys.modules['modules.goals'].process(test_string)
else:
click.echo('No input specified. Run with --help for info')
@cli.command()
@click.pass_context
@click.argument('input', nargs=1,required=True, callback=alias.alias_checker)
def ascii_transform(ctx, input):
"""
Transform an image into ascii \n\n
Pass the absolute path to the image as the argument\n
"""
input = util.get_arguments(ctx,-1)
if input:
test_string = ''
for i in input:
test_string += (i+'')
data = sys.modules['modules.asciiator'].process(str(test_string))
else:
click.echo('No input specified. Run with --help for info')
print(data)
cli.add_command(gif.gif)
from modules import weather
@cli.command()
@click.pass_context
@click.argument('input', nargs=-1, required=False, callback=alias.alias_checker)
def weather(ctx, input):
"""
Get weather\n
To use, type: yoda weather <location>
"""
input = util.get_arguments(ctx, -1)
if input:
test_string = ''
for i in input:
test_string += (i + ' ')
data = sys.modules['modules.weather'].get_weather(test_string)
else:
click.echo('No input specified. Run with --help for info')