From 856aac2bcb5ffe0685f9a6905b66cd3a2fb7a349 Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Mon, 19 Oct 2015 11:51:08 +0200 Subject: [PATCH] Clean up bin and create https://github.com/paradoxxxzero/butterfly-demos --- butterfly/__init__.py | 2 +- butterfly/bin/calendar.py | 13 ------------- butterfly/bin/help.py | 15 ++++++++------- butterfly/bin/hr.py | 4 ---- butterfly/bin/html.py | 10 ++++++++++ butterfly/bin/test.py | 12 ------------ 6 files changed, 19 insertions(+), 37 deletions(-) delete mode 100644 butterfly/bin/calendar.py delete mode 100644 butterfly/bin/hr.py delete mode 100644 butterfly/bin/test.py diff --git a/butterfly/__init__.py b/butterfly/__init__.py index 60c7704..3c5fa3d 100644 --- a/butterfly/__init__.py +++ b/butterfly/__init__.py @@ -14,7 +14,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -__version__ = '2.0.0-beta5' +__version__ = '2.0.0-beta6' import os diff --git a/butterfly/bin/calendar.py b/butterfly/bin/calendar.py deleted file mode 100644 index 9a3a017..0000000 --- a/butterfly/bin/calendar.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python - -from calendar import LocaleHTMLCalendar -from datetime import datetime -import locale -now = datetime.now() -calendar = LocaleHTMLCalendar(locale=locale.getlocale()) -calendar_table = calendar.formatmonth(now.year, now.month) -calendar_table = calendar_table.replace('border="0"', 'border="1"') - -print('\x1bP;HTML|') -print(calendar_table) -print('\x1bP') diff --git a/butterfly/bin/help.py b/butterfly/bin/help.py index a82c74d..c3559ef 100644 --- a/butterfly/bin/help.py +++ b/butterfly/bin/help.py @@ -30,13 +30,14 @@ Butterfly is a xterm compliant terminal built with python and javascript. {title}Butterfly programs:{reset} - {strong}b : {reset}Alias for {strong}butterfly{reset} executable. Takes a comand in parameter or launch a butterfly server for one shot use (if outside butterfly). - {strong}b cat : {reset}A wrapper around cat allowing to display images as instead of binary. - {strong}b open : {reset}Open a new terminal at specified location. - {strong}b session : {reset}Open or rattach a butterfly session. Multiplexing is supported. - {strong}b colors : {reset}Test the terminal colors (16, 256 and 16777216 colors) - {strong}b hr : {reset}Put a html hr. This is a test for html output. - {strong}b calendar : {reset}Display current month using html. This is also a test for html output. + {strong}b : {reset}Alias for {strong}butterfly{reset} executable. Takes a comand in parameter or launch a butterfly server for one shot use (if outside butterfly). + {strong}b cat : {reset}A wrapper around cat allowing to display images as instead of binary. + {strong}b open : {reset}Open a new terminal at specified location. + {strong}b session : {reset}Open or rattach a butterfly session. Multiplexing is supported. + {strong}b colors : {reset}Test the terminal colors (16, 256 and 16777216 colors) + {strong}b html : {reset}Output in html standard input. + + For more butterfly programs check out: https://github.com/paradoxxxzero/butterfly-demos {title}Styling butterfly:{reset} diff --git a/butterfly/bin/hr.py b/butterfly/bin/hr.py deleted file mode 100644 index 8bf5a05..0000000 --- a/butterfly/bin/hr.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env python -import sys -sys.stdout.write('\x1bP;HTML|
\x1bP') -sys.stdout.flush() diff --git a/butterfly/bin/html.py b/butterfly/bin/html.py index 45cb098..c033bab 100644 --- a/butterfly/bin/html.py +++ b/butterfly/bin/html.py @@ -1,8 +1,18 @@ #!/usr/bin/env python from butterfly.escapes import html +import argparse import fileinput import sys +parser = argparse.ArgumentParser( + description="Butterfly html converter.\n\n" + "Output in html standard input.\n" + "Example: $ echo \"Bold\" | b html", + formatter_class=argparse.RawTextHelpFormatter) + +parser.parse_known_args() + + with html(): for line in fileinput.input(): sys.stdout.write(line) diff --git a/butterfly/bin/test.py b/butterfly/bin/test.py deleted file mode 100644 index e2b3811..0000000 --- a/butterfly/bin/test.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python -import sys -w = sys.stdout.write -print('Image injection test') -injection = 'R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" onload="alert(\'pwnd\')" />') -w('\x1bP')