Skip to content

Commit

Permalink
Beta 0.0.2b0
Browse files Browse the repository at this point in the history
  • Loading branch information
eanorambuena committed Apr 4, 2022
1 parent 832aa36 commit d9d4f8f
Show file tree
Hide file tree
Showing 57 changed files with 1,924 additions and 39 deletions.
7 changes: 7 additions & 0 deletions build/lib/eggdriver/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from eggdriver.driver import init
from eggdriver.library import *
from eggdriver.news import *
from eggdriver.resources import *
from eggdriver.app import *
from eggdriver.pypi import *
from eggdriver.version import *
11 changes: 11 additions & 0 deletions build/lib/eggdriver/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from eggdriver.app import eggConsole
import sys

for command in sys.argv[1:]:
if command == "console":
eggConsole()
else:
try:
eggConsole(str(command))
except:
print("Error: Please write the command accurately")
68 changes: 68 additions & 0 deletions build/lib/eggdriver/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from eggdriver.resources.console import get, clearConsole, pg
from eggdriver.resources.constants import white, blue, green
from eggdriver.resources.modules import installFromRequests, upgrade, Repo
from eggdriver.resources.help import welcome
from eggdriver.resources.auth import login, register

"""
FUNCTION eggConsole(command = None)
Display the Eggdriver Console
Currently, the Eggdriver Console commands are:
$nqs Start the NQS Depeloper console
$new Start the News Journalist console
$login Log in Egg-cosystem *comming soon*
$register Register in Egg-cosystem *comming soon*
$install Install a pip package
$upgrade Upgrade a pip package
$pull Import a package stored on a GitHUb repository *comming soon: currently, just use github_com package*
$help Get started command
$clear Clear the Egg Console
$end End the Eggdriver Console
WARNING:
Always use $end command in every console you run
"""
def eggConsole(command = None):
"""Display the Eggdriver Console"""
print(white + "Eggdriver Console is now running")
condition = True
logged = False
while condition:
if command == None:
i = get("egg")
else:
i = "$" + str(command)
print(blue + "$egg> " + green + i + white + "executed")
condition = False
if i == "$nqs":
from nqs import developerConsole
developerConsole()
elif i == "$new":
from eggdriver.news import journalistConsole
journalistConsole()
elif i == "$login":
logged = login()
elif i == "$register":
register()
elif i == "$install":
name = pg("Package:")
installFromRequests([name], False)
elif i == "$upgrade":
name = pg("Package:")
upgrade(name)
elif i == "$pull":
org = pg("User or Organization:")
name = pg("Repository:")
repo = Repo(org, name)
repo.pull()
elif i == "$help":
welcome()
elif i == "$clear":
clearConsole()
elif i == "$end":
print(white + "Eggdriver Console stopped running")
return None
else:
pass
20 changes: 20 additions & 0 deletions build/lib/eggdriver/driver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from eggdriver.resources.modules import installFromRequests, install_option_1
from eggdriver.resources.console import sleep
from eggdriver.resources.server import Server

"""
FUNCTION init()
Initialize Repository:
- Upgrade pip
- Install all the packages in requests file
Eg:
init()
>>> Requirement already satisfied: pip in <root> (21.2.4)
"""
def init():
"""Upgrade pip and install all the packages in requests file"""
install_option_1("$upgrade") # Upgrade pip
sleep(10) # Waits 10 ms
installFromRequests() # Install all the packages in requests file
42 changes: 42 additions & 0 deletions build/lib/eggdriver/library/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from eggdriver.library.repos import *

author="eanorambuena"
_author_email="eanorambuena@uc.cl"

eggConsoleCommands=[
"nqs",
"new",
"login,"
"register",
"install",
"upgrade",
"pull",
"help",
"clear",
"end"
]

developerConsoleCommands=[
"display",
"compile",
"save",
"run",
"end",
"delay"
]

nqsCommands=[
"host",
"shots",
"hist",
"draw",
"inject",
"function",
"clear",
"delay"
]

journalistConsoleCommands=[
"save",
"end",
]
41 changes: 41 additions & 0 deletions build/lib/eggdriver/library/commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
_author = "eanorambuena"
_author_email = "eanorambuena@uc.cl"

eggConsoleCommands = [
"nqs",
"new",
"login,"
"register",
"install",
"upgrade",
"pull",
"help",
"clear",
"end"
]

developerConsoleCommands = [
"display",
"compile",
"save",
"run",
"delay",
"end"
]

nqsCommands = [
"host",
"shots",
"hist",
"draw",
"inject",
"function",
"clear",
"delay"
]

journalistConsoleCommands = [
"save",
"end"
]

4 changes: 4 additions & 0 deletions build/lib/eggdriver/library/repos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from eggdriver.resources.modules import Repo

# NQS=Repo("PythonForChange", "eggdriver")
# nqs=NQS.pull("nqs")
3 changes: 3 additions & 0 deletions build/lib/eggdriver/news/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from eggdriver.news.app import *
from eggdriver.news.config import *
from eggdriver.news.news import *
38 changes: 38 additions & 0 deletions build/lib/eggdriver/news/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#Imports
from eggdriver.news.news import New
from eggdriver.news.config import files, year
from eggdriver.resources.console import get
from eggdriver.resources.constants import *

def journalistConsole(condition: bool = True):
print(white + "Journalist Console is now running")
while condition:
print(white + "Title:")
title=get("new")
print(white + "Day:")
day=int(get("new"))
print(white + "Month:")
month=int(get("new"))
new=New(title, day, month, year, files)
print(white + "Tags:")
tagsbycommas = get("new")
new.tags = tagsbycommas.split(", ")
print(white + "Content:")
content = ""
while True:
i = get("new")
if i == "$save":
new.text = content
new.add()
break
elif i[0] == "$":
print(white + "Error: NQS could not found the command \"" + i + " \"")
else:
content += i + "\n"
print(white + "Write $end to close the console")
print(white + "Press enter key to write other new")
command = get("new")
if command == "$end":
print(white + "Journalist Console stopped running")
return "done"

6 changes: 6 additions & 0 deletions build/lib/eggdriver/news/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from datetime import date
todaysDate = date.today()

# News Config
files = ["README.md"]
year = int(todaysDate.year)
72 changes: 72 additions & 0 deletions build/lib/eggdriver/news/news.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
from eggdriver.resources.console import sleep

class New():
def __init__(self, title: str, day: int, month: int, year: int = 2021, files = ["README.md"]):
self.title = title
if day < 10:
newday = "0" + str(day)
else:
newday = str(day)
if month < 10:
newmonth = "0" + str(month)
else:
newmonth = str(month)
self.date = newmonth + "/" + newday + "/" + str(year)
self.place = "Santiago, Chile"
self.text = ""
self.tags = []
self.files = files
def tag(self, text: str):
try:
self.tags.append(text)
except:
print("A tagging bug was happen")
def format(self):
t = "\n### " + self.title + "\n#### " + self.date + " " + self.place
t += "\n##### Tags: "
try:
for i in self.tags:
t += "[" + i + "](https://github.com/topics/" + i + ")"
except:
pass
t += "\n" + self.text + "\n"
return t
def add(self):
try:
T = self.format()
try:
for i in self.files:
f = open(i,"a")
f.write(T)
print("Writting the new in " + i)
sleep(100)
f.close()
print("New added succesfully")
print("Title: " + self.title)
print("Date: " + self.date)
print("Content: " + preview(self.text.split()))
except:
print("A writting bug was happen")
except:
print("A formatting bug was happen")

def preview(string: str):
preview = ""
try:
preview += string[0]
except:
pass
try:
preview += " " + string[1]
except:
pass
try:
preview += " " + string[2]
except:
pass
try:
preview += " "+ string[3]
except:
pass
preview += "..."
return preview
Loading

0 comments on commit d9d4f8f

Please sign in to comment.