Compare commits
No commits in common. "63c5ad520d9c1d2cd80a22034636b45668dcf366" and "4b25f8f2bd41db0d663fae405346e5ef2596bcfd" have entirely different histories.
63c5ad520d
...
4b25f8f2bd
25
bin/grep.py
25
bin/grep.py
|
@ -1,25 +0,0 @@
|
|||
import os
|
||||
import re
|
||||
import console
|
||||
|
||||
def get_app_class(template):
|
||||
class App(template):
|
||||
def F_main(self):
|
||||
pattern = self.argv[1].encode("utf-8")
|
||||
file = self.argv[2]
|
||||
|
||||
try:
|
||||
with open(file, "rb") as f:
|
||||
for line in f.readlines():
|
||||
if re.search(pattern, line):
|
||||
self.console.write(line)
|
||||
except OSError as e:
|
||||
try:
|
||||
os.listdir(file)
|
||||
console.write_str(self.console, f"grep: {file}: Is a directory\n")
|
||||
except OSError:
|
||||
console.write_str(self.console, f"grep: {file}: No such file or directory\n")
|
||||
|
||||
self.exit()
|
||||
|
||||
return App
|
|
@ -1,5 +1,3 @@
|
|||
from fibonaccios.exceptions import *
|
||||
|
||||
_cache = {}
|
||||
|
||||
def get_app(app):
|
||||
|
@ -8,7 +6,7 @@ def get_app(app):
|
|||
except KeyError:
|
||||
try:
|
||||
module = __import__(f'/bin/{app}')
|
||||
except ImportError:
|
||||
except AttributeError:
|
||||
raise AppNotFound(app)
|
||||
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user