Skip to content

Commit

Permalink
fix: cli
Browse files Browse the repository at this point in the history
  • Loading branch information
cupen committed May 6, 2024
1 parent ee82a3f commit 15be18c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions excel2xx/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Export data from Excel file.
Usage:
excel2xx.py json <excel> -o FILE -- [options]
excel2xx.py json <excel> -o FILE [options]
excel2xx.py msgpack <excel> -o FILE [options]
excel2xx.py mako <excel> --template=FILE [options]
excel2xx.py build --from=DIR --to=DIR [options]
Expand Down Expand Up @@ -55,16 +55,17 @@ def main(args):
)
excel = Excel(src, fieldMeta=meta)
if args["json"]:
dest = dest or f"{src}.json"
dest = dest or make_fname(src, ".json")
export.toJson(excel, dest)
elif args["msgpack"]:
dest = dest or f"{src}.msgp"
dest = dest or make_fname(src, ".msgp")
export.toMsgPack(excel, dest)
elif args["mako"]:
template = args["--template"]
if not dest:
if not template:
print("Missing '--template', which is mako template file.")
return 1
dest = dest or os.path.splitext(template)[0]
export.toMako(excel, dest, template)
elif args["build"]:
raise NotImplementedError("build is developing.")
Expand All @@ -88,6 +89,8 @@ def main_docopt(argv=None):
return 2
pass

def make_fname(src, ext):
return os.path.splitext(src)[0] + ext

if __name__ == "__main__":
import sys
Expand Down
2 changes: 1 addition & 1 deletion excel2xx/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "0.11.7"
VERSION = "0.11.8"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _open(fname):

setup(
name="excel2xx",
version="0.11.7",
version="0.11.8",
url="https://github.com/cupen/excel2xx",
license="WTFPL",
author="cupen",
Expand Down

0 comments on commit 15be18c

Please sign in to comment.