Skip to content

Commit

Permalink
v2.1 from the old code base
Browse files Browse the repository at this point in the history
changelog:
>Added a virtual file system. It replaces the root/ file in the system.
  • Loading branch information
nayas360 committed Jun 25, 2017
1 parent 7d67c13 commit 5c21ca4
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 129 deletions.
Binary file added FileSystem.fs
Binary file not shown.
1 change: 0 additions & 1 deletion bin/.exception
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ object
oct
open
ord
pow
print
property
quit
Expand Down
4 changes: 4 additions & 0 deletions bin/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def get_func_list():
rem = ['__init__',
'__pycach',
'core',
'vfs',
'common',
'.conf',
'.last_tmp',
Expand Down Expand Up @@ -227,6 +228,9 @@ def analyze(inp):
# print(inp)
# check if is a directory
if os.path.isdir(get_path() + inp):
if '.' in inp:
err(0, inp)
return
print('"', inp, '" is a directory', sep='')
return
elif os.path.isfile(get_path() + inp):
Expand Down
4 changes: 4 additions & 0 deletions bin/core.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# CORE file contains main shell mechanisms
from importlib import import_module as _import
from bin.common import *
from bin.vfs import init


class shell():
def __init__(self):
init()

def __repr__(self):
return '<Shell Instance>'

Expand Down
2 changes: 2 additions & 0 deletions bin/exit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Exit function
from bin.common import sleep
from bin.vfs import end
from sys import exit


Expand Down Expand Up @@ -41,4 +42,5 @@ def main(argv):
print('Closed Everything...')
print('will exit in 2 seconds...')
sleep(2)
end()
exit()
2 changes: 1 addition & 1 deletion bin/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

v = '''
[version]
v2.0
v2.1
[author]
Sayan Dutta
Expand Down
19 changes: 11 additions & 8 deletions bin/lcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ def main(argv):
if '-s' in argv:
argv.pop(0) # remove com name
argv.pop(0) # remove arg
arg = make_s2(argv[0])
if arg.isupper():
arg = arg.lower()
print('Section:', arg.upper())
for i in f:
if i[0] == arg:
print(' ==>', i)
return
try:
arg = make_s2(argv[0])
if arg.isupper():
arg = arg.lower()
print('Section:', arg.upper())
for i in f:
if i[0] == arg:
print(' ==>', i)
return
except IndexError:
_help()

last = 'a'
for i in f:
Expand Down
8 changes: 5 additions & 3 deletions bin/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ def lock():
data = kw.readline()
p = '''The shell is LOCKED.'''
print(p)
inp = get_hash(getpass.getpass('Password: '))
inp = get_hash(getpass.getpass())
if inp in data:
return
else:
print('Incorrect password !')
print('\nIncorrect password !')
lock()
except IOError:
p = '''
Expand All @@ -56,6 +56,8 @@ def lock():
'''
print(p)
_reg_pass()
print('Now locking the shell...\n')
lock()


def _reg_pass():
Expand All @@ -66,7 +68,7 @@ def _reg_pass():
print(p)
_pass = get_pass()
with open(key, 'w') as kw:
print(_pass, file=kw)
print(_pass, sep='\n', file=kw)
print('\nPassword was registered...')


Expand Down
18 changes: 15 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# dummy main()
# Shell prototype
from bin.core import *

from shell import *
P = 'sdcard/com.hipipal.qpyplus/projects3/shell'
try:
os.chdir(P)
except OSError:
pass

main()

def main():
s = shell()
s.start()


if __name__ == '__main__':
main()
2 changes: 0 additions & 2 deletions root/.hide/.hidden.txt

This file was deleted.

18 changes: 0 additions & 18 deletions root/.hide/hide.txt

This file was deleted.

17 changes: 0 additions & 17 deletions root/r_hidden.s

This file was deleted.

25 changes: 0 additions & 25 deletions root/r_lock.s

This file was deleted.

15 changes: 0 additions & 15 deletions root/r_test.s

This file was deleted.

15 changes: 0 additions & 15 deletions root/r_test2.s

This file was deleted.

3 changes: 0 additions & 3 deletions root/test/test.txt

This file was deleted.

7 changes: 0 additions & 7 deletions root/test/test2/w_test.txt

This file was deleted.

7 changes: 0 additions & 7 deletions root/test/test2/w_test2.txt

This file was deleted.

3 changes: 0 additions & 3 deletions root/test/w_test.txt

This file was deleted.

1 change: 0 additions & 1 deletion shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
except OSError:
pass


def main():
s = shell()
s.start()
Expand Down

0 comments on commit 5c21ca4

Please sign in to comment.