forked from yoda-pa/yoda
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathyoda.py
192 lines (166 loc) · 4.88 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
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.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 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
"""
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.define)
@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')