Skip to content

Commit 7b2c40e

Browse files
committed
Add __main__ and commands
1 parent f06dbc2 commit 7b2c40e

File tree

16 files changed

+90
-50
lines changed

16 files changed

+90
-50
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
config.py
1+
eggconfig.py
490 Bytes
Binary file not shown.

eggdriver/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
from eggdriver.resources import *
66
from eggdriver.app import *
77
from eggdriver.pypi import *
8-
from eggdriver.version import *
8+
from eggdriver.version import *

eggdriver/__main__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from eggdriver.app import eggConsole
2+
import sys
3+
4+
for command in sys.argv[1:]:
5+
if command == "console":
6+
eggConsole()
7+
else:
8+
try:
9+
eggConsole(str(command))
10+
except:
11+
print("Error: Please write the command accurately")
12 Bytes
Binary file not shown.
386 Bytes
Binary file not shown.
144 Bytes
Binary file not shown.

eggdriver/app.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from eggdriver.resources.console import get, clearConsole, pg
2-
from eggdriver.resources.constants import white
2+
from eggdriver.resources.constants import white, blue, green
33
from eggdriver.resources.modules import installFromRequests, upgrade, Repo
4-
from eggdriver.resources.help import help
4+
from eggdriver.resources.help import welcome
55
from eggdriver.resources.auth import login, register
66

77
"""
8-
FUNCTION eggConsole(condition: bool = True)
8+
FUNCTION eggConsole(command = None)
99
10-
Display the Egg Console
11-
Currently, the Egg Console commands are:
10+
Display the Eggdriver Console
11+
Currently, the Eggdriver Console commands are:
1212
1313
$nqs Start the NQS Depeloper console
1414
$new Start the News Journalist console
@@ -19,27 +19,31 @@
1919
$pull Import a package stored on a GitHUb repository *comming soon: currently, just use github_com package*
2020
$help Get started command
2121
$clear Clear the Egg Console
22-
$end End the Egg Console
22+
$end End the Eggdriver Console
2323
2424
WARNING:
25-
Always use $end command in every console you run
26-
*ONLY use a condition different to True as an argument of eggConsole(condition) if you know what are you doing**
27-
This is the reason why condition only allows <<bool>> as data type
25+
Always use $end command in every console you run
2826
"""
29-
def eggConsole(condition: bool = True):
30-
"""Display the Egg Console"""
31-
print(white + "Egg Console is now running")
32-
logged = 0
27+
def eggConsole(command = None):
28+
"""Display the Eggdriver Console"""
29+
print(white + "Eggdriver Console is now running")
30+
condition = True
31+
logged = False
3332
while condition:
34-
i = get("egg")
33+
if command == None:
34+
i = get("egg")
35+
else:
36+
i = "$" + str(command)
37+
print(blue + "$egg> " + green + i + white + "executed")
38+
condition = False
3539
if i == "$nqs":
3640
from eggdriver.nqs import developerConsole
3741
developerConsole()
3842
elif i == "$new":
3943
from eggdriver.news import journalistConsole
4044
journalistConsole()
4145
elif i == "$login":
42-
login()
46+
logged = login()
4347
elif i == "$register":
4448
register()
4549
elif i == "$install":
@@ -54,11 +58,11 @@ def eggConsole(condition: bool = True):
5458
repo = Repo(org, name)
5559
repo.pull()
5660
elif i == "$help":
57-
help()
61+
welcome()
5862
elif i == "$clear":
5963
clearConsole()
6064
elif i == "$end":
61-
print(white + "Egg Console stopped running")
62-
return "done"
65+
print(white + "Eggdriver Console stopped running")
66+
return None
6367
else:
6468
pass

eggdriver/library/commands.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
_author="eanorambuena"
2-
_author_email="eanorambuena@uc.cl"
1+
_author = "eanorambuena"
2+
_author_email = "eanorambuena@uc.cl"
33

4-
eggConsoleCommands=[
4+
eggConsoleCommands = [
55
"nqs",
66
"new",
77
"login,"
@@ -14,7 +14,7 @@
1414
"end"
1515
]
1616

17-
developerConsoleCommands=[
17+
developerConsoleCommands = [
1818
"display",
1919
"compile",
2020
"save",
@@ -23,7 +23,7 @@
2323
"end"
2424
]
2525

26-
nqsCommands=[
26+
nqsCommands = [
2727
"host",
2828
"shots",
2929
"hist",
@@ -34,7 +34,8 @@
3434
"delay"
3535
]
3636

37-
journalistConsoleCommands=[
37+
journalistConsoleCommands = [
3838
"save",
3939
"end"
40-
]
40+
]
41+
212 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)