Skip to content

Commit

Permalink
feat: add option to set custom root page name
Browse files Browse the repository at this point in the history
  • Loading branch information
vzhd1701 committed Apr 7, 2022
1 parent 736163e commit 2a7b2ce
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions enex2notion/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def cli(argv):
if args.mode_webclips == "PDF":
ensure_wkhtmltopdf()

root = get_root(args.token)
root = get_root(args.token, args.root_page)

enex_uploader = EnexUploader(
import_root=root,
Expand All @@ -143,7 +143,7 @@ def cli(argv):
enex_uploader.upload(enex_input)


def get_root(token):
def get_root(token, name):
if not token:
logger.warning(
"No token provided, dry run mode. Nothing will be uploaded to Notion!"
Expand All @@ -156,7 +156,7 @@ def get_root(token):
logger.error("Invalid token provided!")
sys.exit(1)

return get_import_root(client, "Evernote ENEX Import")
return get_import_root(client, name)


def main(): # pragma: no cover
Expand Down Expand Up @@ -185,6 +185,16 @@ def parse_args(argv):
" [NEEDED FOR UPLOAD]"
),
},
"--root-page": {
"type": str,
"default": "Evernote ENEX Import",
"help": (
"root page name for the imported notebooks,"
" it will be created if it does not exist"
' (default: "Evernote ENEX Import")'
),
"metavar": "NAME",
},
"--mode": {
"choices": ["DB", "PAGE"],
"default": "DB",
Expand Down

0 comments on commit 2a7b2ce

Please sign in to comment.