-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
71 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[build-system] | ||
requires = ["setuptools"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "ezon-gpx" | ||
version = "0.1.0" | ||
authors = [ | ||
{name = "Uiolee"}, | ||
] | ||
readme = "README.md" | ||
license = {text = "MPL-2.0"} | ||
|
||
[project.scripts] | ||
ezon-gpx = "cli:cli" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import argparse | ||
from os import listdir | ||
from os.path import join, isdir | ||
|
||
from main import convert | ||
|
||
|
||
def cli(): | ||
parser = argparse.ArgumentParser(prog="ezon-gpx") | ||
|
||
parser.add_argument( | ||
"path", | ||
nargs="+", | ||
) | ||
parser.add_argument("-o", "--out", help="the filename of output") | ||
parser.add_argument( | ||
"-d", "--dir", help="the dest dir of output", type=str, default="dist" | ||
) | ||
parser.add_argument("--hour", help="hour offset", type=int, default=-8) | ||
parser.add_argument( | ||
"--indent", help="output file with indent", type=bool, default=False | ||
) | ||
parser.add_argument("--strict", help="strict", type=bool, default=False) | ||
args = parser.parse_args() | ||
|
||
print() | ||
print("====== ezon-gpx cli ======") | ||
print(args) | ||
|
||
paths = [] | ||
for path in args.path: | ||
if path.endswith(".gpx"): | ||
paths.append(path) | ||
elif isdir(path): | ||
for p in listdir(path): | ||
if p.endswith(".gpx"): | ||
paths.append(join(path, p)) | ||
|
||
for path in paths: | ||
print() | ||
print("[cli.py]", "processing", path) | ||
convert(path, args.out, args.dir, args.hour, args.indent, args.strict) | ||
|
||
print() | ||
print("[cli.py]", "processed files:", len(paths)) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/bash | ||
|
||
python cli.py test | ||
python src/cli.py test |