init commit

master
Paul Walko 2016-12-23 00:41:14 -05:00
commit 843bae8fa0
2 changed files with 53 additions and 0 deletions

38
bash.py Normal file
View File

@ -0,0 +1,38 @@
from flask import Flask, render_template
import os
app = Flask(__name__)
@app.route("/")
def show_entries():
bash_quotes = 'bash_logs'
bash_quotes_path = os.path.join(os.path.expanduser('~/.phenny'), bash_quotes)
if not os.path.exists(bash_quotes_path):
return
files = os.listdir(bash_quotes_path)
for i in range(len(files)):
files[i] = files[i].replace('.txt', '')
files[i] = int(files[i])
files.sort()
for i in range(len(files)):
files[i] = ''.join([str(files[i]), '.txt'])
files_contents = []
for f in files:
f = os.path.join(bash_quotes_path, f)
with open(f) as fOpen:
content = fOpen.readlines()
files_contents.append(content)
for files in files_contents:
for line in files:
line = line.replace('<', '&lt;')
line = line.replace('>', '&gt;')
return render_template('show_entries.html', entries=files_contents, i=range(len(files_contents)))
if __name__ == "__main__":
app.run()

View File

@ -0,0 +1,15 @@
<!doctype html>
<title>vtbash</title>
{% block body %}
{% for j in i %}
<p style="background-color: rgba(255,102,0,.2);">
#{{ j + 1 }}<br>
{% for line in entries[j] %}
{{ line }}<br>
{% endfor %}
</p>
<br>
{% else %}
<p>Unbelievable. No Entries here so far</p>
{% endfor %}
{% endblock %}