Skip to content

Commit b77a0db

Browse files
committed
added cli interface and README fixes
1 parent 573641f commit b77a0db

File tree

5 files changed

+60
-8
lines changed

5 files changed

+60
-8
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ It also has it's own file system, in tne form of the `filesys` folder, that it c
55

66
## Usage
77

8-
To boot project shadow, you can use `./boot.sh` or on windows just open the file. You will need to have the latest version of [python](https://www.python.org/downloads/) installed,
8+
You will need to have the latest version of [python](https://www.python.org/downloads/) installed,
99
and for full functionality, have nano installed on your system.
1010
#
1111
> **Warning:** WINDOWS IS NOT SUPPORTED AS THIS PROGRAM REQUIRES TOUCH. PLEASE USE THE DOCKER VERSION!
@@ -22,6 +22,11 @@ $~# files
2222
E~# Email
2323
```
2424

25+
## Booting
26+
27+
To boot, you can either `import app` in a python program or terminal, or use the click cli interface.
28+
For more information, use `python3 shadow.py --help` in the root directory.
29+
2530
### Home Page
2631

2732
The homepage commands are as follows:
@@ -68,6 +73,7 @@ and exit will go back to the homepage. Clear works in the same way, except for t
6873
### Email Client
6974

7075
The email client is a simple email client using smtplib and some dubious code. To use, type `sendmail` or `send` into the terminal and follow the prompts.
76+
> **Warning:** The file attachment will grab files from the root directory as opposed to the filesystem.
7177
7278
### Misc
7379

@@ -86,7 +92,8 @@ app.terminal() Load the terminal
8692
app.email() Load the email client
8793
load.msg() Generate prompts
8894
```
89-
They are all standalone and should work without the rest of the system. NOTE: Upon exit, the function returns and ends the while loop. it does not call another function
95+
They are all standalone and should work without the rest of the system.
96+
These are also all accesible from the shadow.py file NOTE: Upon exit, the function returns and ends the while loop. it does not call another function
9097
When home calls a function, it does not return until it exits.
9198

9299
## Dockerfile

app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,10 @@ def createlogin():
184184

185185
def login():
186186
global logincred
187-
logincred = open('login.txt', 'r')
187+
try:
188+
logincred = open('login.txt', 'r')
189+
except:
190+
createlogin()
188191
logincred = logincred.read()
189192
logincred = logincred.splitlines()
190193
if logincred == []:

boot.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

login.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
2-
vvyw zypl uicv beqp
1+
placeholder
2+
placeholder

shadow.py

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,55 @@
11
import app
22
import load
33
import random
4+
import click
5+
import os
6+
7+
@click.group()
8+
@click.pass_context
9+
def shadow(ctx):
10+
pass
11+
12+
13+
14+
@shadow.command(help='Boot the system normally')
15+
def boot():
16+
click.echo('Booting the system...')
17+
load.msg(random.randint(1, 5))
18+
app.bootscr()
19+
app.home()
20+
print("broken")
21+
return
22+
23+
@shadow.command(help='Boot straight to the homepage')
24+
def fastboot():
25+
click.echo('Booting to home...')
26+
app.home()
27+
28+
@shadow.command(help='Boot to the file manager')
29+
def files():
30+
click.echo('Booting to files...')
31+
app.files()
32+
33+
@shadow.command(help='Boot to email client')
34+
@click.option('--newmail', is_flag=True, help='Erase email data and input new email')
35+
@click.pass_context
36+
def emails(ctx, newmail):
37+
if newmail == True:
38+
os.system('rm email.txt')
39+
app.email()
40+
else:
41+
app.email()
42+
43+
44+
if __name__ == '__main__':
45+
shadow()
46+
47+
448

549
def boot():
650
load.msg(random.randint(1, 5))
751
app.bootscr()
852
app.home()
953
print("broken")
1054
return
11-
12-
boot()
55+

0 commit comments

Comments
 (0)