Skip to content

Commit 0cb8211

Browse files
committed
patch code for commandline use
1 parent 428cbb2 commit 0cb8211

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

html2excel/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
from .excel.parser import ExcelParser
2-
3-
__all__ = ["ExcelParser"]
2+
__all__ = ["ExcelParser"]

html2excel/__main__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import sys
2+
from html2excel import ExcelParser
3+
4+
5+
if __name__ == "__main__":
6+
if len(sys.argv) == 3:
7+
file_path = sys.argv[1]
8+
save_path = sys.argv[2]
9+
parser = ExcelParser(file_path)
10+
parser.to_excel(save_path)
11+
else:
12+
# First argument for file name, we'll ignore that
13+
print("Expected 2 arguments. Got {num}".format(num=len(sys.argv)-1))
14+
15+
# TODO: handle exceptions

html2excel/base/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__all__ = []

main.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)