move cli functionality to a separate file
This commit is contained in:
parent
d3428354d2
commit
9e44070fe7
2 changed files with 44 additions and 22 deletions
22
recipes.py
22
recipes.py
|
@ -1,6 +1,5 @@
|
|||
from abc import abstractmethod
|
||||
import collections
|
||||
import sys
|
||||
from typing import Dict, List, Any, Optional, Self, Set
|
||||
import os
|
||||
import json
|
||||
|
@ -689,24 +688,3 @@ class Builder:
|
|||
print("ERROR:", e)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
def help() -> None:
|
||||
print(f"usage: {sys.argv[0]} build DIR - build pages in DIR/out")
|
||||
print(f" {sys.argv[0]} -h - show help")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
if len(sys.argv) == 2 and sys.argv[1] == "-h":
|
||||
help()
|
||||
sys.exit(0)
|
||||
elif len(sys.argv) == 3 and sys.argv[1] == "build":
|
||||
ret = Builder().build(sys.argv[2])
|
||||
sys.exit(ret)
|
||||
else:
|
||||
help()
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue