diff --git a/.gitignore b/.gitignore index 415ffa6..2e906ea 100644 --- a/.gitignore +++ b/.gitignore @@ -17,11 +17,7 @@ venv/ # demo 0to100**/ 978*/ -0*/ -repo/ safaribooks/ -*.yaml -toc.md # pip install build @@ -29,6 +25,9 @@ build *.egg-info pip-wheel-metadata/ - # logs -logs/ \ No newline at end of file +logs/ + +# daily use +map.yaml +toc.md \ No newline at end of file diff --git a/Makefile b/Makefile index 333f104..6fad3e3 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +.PHONY: install test testint format lint refactor pr + install: pip install --upgrade pip && pip install -r requirements-dev.txt @@ -5,7 +7,7 @@ test: python -m pytest zero_to_one_hundred testint: - bash demo.sh zt && bash demo.sh sb + bash demo.sh zo && bash demo.sh sb format: black zero_to_one_hundred diff --git a/README.md b/README.md index db29ad8..f3d6912 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,11 @@ Given a 'url', it creates the entry in a markdown map and a folder and links the just open this repo in your GitHub Codespace and run the demo as: ```bash -bash demo.sh zt -``` +bash demo.sh zo +``` ![](2dc4491c-fa27-4c5e-bd0c-71951b3ef0e5.png) -[here](./toc_zt.md) +[here](./toc_zo.md) ```bash bash demo.sh sb @@ -39,17 +39,17 @@ commands: ``` create_section = create a new section section=https://www.cloudskillsboost.google/paths/16 -./main.py zt create_section "$section" +./main.py zo create_section "$section" done_section = tag a section as done section=https://www.cloudskillsboost.google/paths/16 -./main.py zt done_section "$section" +./main.py zo done_section "$section" refresh_map = refresh the section map -./main.py zt refresh_map +./main.py zo refresh_map refresh_links = refresh links to sections in the readme.md(s) -./main.py zt refresh_links +./main.py zo refresh_links ``` > tip @@ -88,7 +88,7 @@ export MAP_YAML_PATH=map.yaml chmod +x *.py # run main -./main.py zt help +./main.py zo help ``` @@ -176,7 +176,7 @@ and you have a `toc.md` for free to use as your index (bookmark it) ## online example -- zt +- zo https://github.com/obar1/zero2hero diff --git a/demo.sh b/demo.sh index ad972ba..86b5de0 100644 --- a/demo.sh +++ b/demo.sh @@ -9,8 +9,8 @@ function setup { chmod +x main.py } -function setup_zt { - cp ./zero_to_one_hundred/tests/test_ztoh/resources/gcp_map.yaml map.yaml +function setup_zo { + cp ./zero_to_one_hundred/tests/tests_zo/resources/gcp_map.yaml map.yaml } function setup_sb { @@ -21,11 +21,11 @@ function setup_sb { pip install --quiet -r safaribooks/requirements.txt } -function zt { +function zo { # 0to100 - setup_zt + setup_zo - ./main.py zt help + ./main.py zo help content=$( cat <<'EOF' https://www.cloudskillsboost.google/0 @@ -37,15 +37,15 @@ https://storage.googleapis.com/cloud-training/cls-html5-courses/T-BQRS-I/M1/inde EOF ) while IFS= read -r section || [[ -n "$section" ]]; do - ./main.py zt create_section "$section" + ./main.py zo create_section "$section" done <<<"$content" echo "# a_custom_header 0" >>0to100/https§§§www.cloudskillsboost.google§0/readme.md - ./main.py zt done_section "https://www.cloudskillsboost.google/0" + ./main.py zo done_section "https://www.cloudskillsboost.google/0" ls -1R 0to100 - cp toc.md toc_zt.md + cp toc.md toc_zo.md } function sb { @@ -72,7 +72,7 @@ function sb { #!/bin/bash if [ $# -eq 0 ]; then - echo "No arguments were passed: use sb or zt" + echo "No arguments were passed: use sb or zo" else setup $1 diff --git a/main.py b/main.py index 2365712..0cc1fef 100755 --- a/main.py +++ b/main.py @@ -1,33 +1,33 @@ #!/usr/bin/env python3 # coding: utf-8 -from enum import Enum -import sys import logging +import sys from zero_to_one_hundred.exceptions.errors import UnsupportedOptionError from zero_to_one_hundred.runner import run_core from zero_to_one_hundred.validator.validator import Validator - + if __name__ == "__main__": logger = logging.getLogger(__name__) logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') try: - arg1= sys.argv[1] - match arg1: - case 'zt': + args = sys.argv[1:] + cmd , p1 , p2 = Validator.validate_args(args) + match cmd: + case 'zo': from zero_to_one_hundred.repository.ztoh_persist_fs import ZTOHPersistFS as persist_fs from zero_to_one_hundred.repository.ztoh_process_fs import ZTOHProcessFS as process_fs from zero_to_one_hundred.factories.ztoh_factory_provider import ZTOHFactoryProvider - run_core(sys.argv, ZTOHFactoryProvider(persist_fs, process_fs)) + run_core(args[1:], ZTOHFactoryProvider(persist_fs, process_fs)) case 'sb': from zero_to_one_hundred.repository.sb_persist_fs import SBPersistFS as persist_fs from zero_to_one_hundred.repository.sb_process_fs import SBProcessFS as process_fs from zero_to_one_hundred.factories.sb_factory_provider import SBFactoryProvider - run_core(sys.argv, SBFactoryProvider(persist_fs, process_fs)) + run_core(args[1:], SBFactoryProvider(persist_fs, process_fs)) case _: raise ValueError - except (ValueError,IndexError, TypeError,UnsupportedOptionError): + except (ValueError,IndexError, TypeError,UnsupportedOptionError) as e: from zero_to_one_hundred.repository.a_persist_fs import APersistFS as persist_fs from zero_to_one_hundred.factories.a_factory_provider import AFactoryProvider run_core(sys.argv, AFactoryProvider(persist_fs)) diff --git a/setup.py b/setup.py index 56be1a5..4a398a1 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name="0to100", - version="0.5.3", + version="0.5.4", author="obar1", packages=find_packages(), author_email="obar1+gh@pm.me", diff --git a/toc_sb.md b/toc_sb.md index 742b634..c29c27f 100644 --- a/toc_sb.md +++ b/toc_sb.md @@ -1,15 +1,17 @@ # TOC ## `2` metabook -### 2024/09/13-11:06:37 +### 2024/09/15-16:52:50 ## legend: **legend_icons** -`Book` :cyclone: +`Book` :book: +`Event` :floppy_disk: +`Course` :whale: | ISBN | img | `meta-contents` | `json-contents` | `status` | `icons` |--- |--- |--- |--- |--- |--- | -|**9780134661742**|![`img`](./9780134661742/9780134661742.png)|[`xyz`](./9780134661742/)|{'isbn': '9780134661742',
'pages_perc': 'n/a',
'title': 'Clean Code Fundamentals',
'url': '> https://learning.oreilly.com/library/9780134661742 <'}|**WIP**|:cyclone:| -|**9781119895947**|![`img`](./9781119895947/9781119895947.png)|[`xyz`](./9781119895947/)|{'isbn': '9781119895947',
'page_curr': '100',
'page_tot': '100',
'pages_perc': '100.0%',
'url': '> https://www.oreilly.com/library/view/rewire-your-brain/9781119895947 <'}|**DONE**|:cyclone:| +|**9780134661742**|![`img`](./9780134661742/9780134661742.png)|[`xyz`](./9780134661742/)|{'isbn': '9780134661742',
'pages_perc': 'n/a',
'title': 'Clean Code Fundamentals',
'url': '> https://learning.oreilly.com/library/9780134661742 <'}|**WIP**|:book:| +|**9781119895947**|![`img`](./9781119895947/9781119895947.png)|[`xyz`](./9781119895947/)|{'isbn': '9781119895947',
'page_curr': '100',
'page_tot': '100',
'pages_perc': '100.0%',
'url': '> https://www.oreilly.com/library/view/rewire-your-brain/9781119895947 <'}|**DONE**|:book:| \ No newline at end of file diff --git a/toc_zt.md b/toc_zo.md similarity index 100% rename from toc_zt.md rename to toc_zo.md diff --git a/zero_to_one_hundred/configs/sb_config_map.py b/zero_to_one_hundred/configs/sb_config_map.py index 80fe46b..03ed685 100644 --- a/zero_to_one_hundred/configs/sb_config_map.py +++ b/zero_to_one_hundred/configs/sb_config_map.py @@ -17,24 +17,24 @@ def get_books_path(self): @property def get_download_engine_path(self): - return self.load["configs"]["download_engine_path"] + return self.load["download_engine_path"] @property def get_download_engine_books_path(self): - return self.load["configs"]["download_engine_books_path"] + return self.load["download_engine_books_path"] @property def get_oreilly_username(self): - return self.load["configs"]["oreilly_username"] + return self.load["oreilly_secrets"]["username"] @property def get_oreilly_userpassword(self): - return self.load["configs"]["oreilly_userpassword"] + return self.load["oreilly_secrets"]["password"] @property def get_split_pdf_pages(self): - return int(self.load["configs"]["split_pdf_pages"]) + return int(self.load["split_pdf_pages"]) @property def get_download_books(self): - return bool(self.load["configs"]["download_books"]) + return bool(self.load["download_books"]) diff --git a/zero_to_one_hundred/configs/ztoh_config_map.py b/zero_to_one_hundred/configs/ztoh_config_map.py index 5832022..d7b1214 100644 --- a/zero_to_one_hundred/configs/ztoh_config_map.py +++ b/zero_to_one_hundred/configs/ztoh_config_map.py @@ -1,7 +1,7 @@ from zero_to_one_hundred.configs.a_config_map import AConfigMap from zero_to_one_hundred.repository.ztoh_persist_fs import ZTOHPersistFS -ZTOH_MAP = "ztoh-map" +ZTOH_MAP = "zero-to-one-hundred-map" class ZTOHConfigMap(AConfigMap): @@ -14,8 +14,8 @@ def get_repo_path(self): @property def get_repo_map_md(self): - return self.load["repo"]["map_md"] + return self.load["repo"]["idx_id"] @property def get_repo_sorted(self) -> bool: - return self.load["repo"].get("sorted") + return self.load["repo"].get("idx_sort") diff --git a/zero_to_one_hundred/factories/a_factory.py b/zero_to_one_hundred/factories/a_factory.py index eae26fb..3347edb 100644 --- a/zero_to_one_hundred/factories/a_factory.py +++ b/zero_to_one_hundred/factories/a_factory.py @@ -11,13 +11,13 @@ class AFactory: """AFactory class.""" class SUPPORTED_PROCESSOR(Enum): - zt = 1 + zo = 1 sb = 2 help = 3 extended_help = """ - zt = zero to 100 - ./main.py zt help + zo = zero to 100 + ./main.py zo help sb = sb to 100 ./main.py sb help @@ -29,7 +29,7 @@ class SUPPORTED_PROCESSOR(Enum): def __init__(self, persist_fs: APersistFS): self.persist_fs = persist_fs - def get_processor(self,args) -> Generator[AProcessor, None, None]: + def get_processor(self, args) -> Generator[AProcessor, None, None]: yield self.help_processor() def help_processor(self): diff --git a/zero_to_one_hundred/factories/sb_factory.py b/zero_to_one_hundred/factories/sb_factory.py index a16df62..e292b6e 100644 --- a/zero_to_one_hundred/factories/sb_factory.py +++ b/zero_to_one_hundred/factories/sb_factory.py @@ -35,7 +35,7 @@ def __init__( self.process_fs = process_fs def get_processor(self, args): - cmd, p1 = Validator.validate_args(args) + cmd, p1, _ = Validator.validate_args(args) if cmd == SBFactory.SUPPORTED_PROCESSOR.snatch_book.name: http_url = p1 yield self.snatch_book_processor(http_url) diff --git a/zero_to_one_hundred/factories/ztoh_factory.py b/zero_to_one_hundred/factories/ztoh_factory.py index ce4168d..fce2dc1 100644 --- a/zero_to_one_hundred/factories/ztoh_factory.py +++ b/zero_to_one_hundred/factories/ztoh_factory.py @@ -26,17 +26,17 @@ class SUPPORTED_PROCESSOR(Enum): extended_help = """ create_section = create a new section section=https://www.cloudskillsboost.google/paths/16 - ./main.py zt create_section "$section" + ./main.py zo create_section "$section" done_section = tag a section as done section=https://www.cloudskillsboost.google/paths/16 - ./main.py zt done_section "$section" + ./main.py zo done_section "$section" refresh_map = refresh the section map - ./main.py zt refresh_map + ./main.py zo refresh_map refresh_links = refresh links to sections in the readme.md(s) - ./main.py zt refresh_links + ./main.py zo refresh_links """ def __init__( @@ -50,7 +50,7 @@ def __init__( self.process_fs = process_fs def get_processor(self, args): - cmd, p1 = Validator.validate_args(args) + cmd, p1, _ = Validator.validate_args(args) if cmd == ZTOHFactory.SUPPORTED_PROCESSOR.create_section.name: yield self.create_section_processor(p1) yield self.refresh_map_processor() diff --git a/zero_to_one_hundred/tests/test_ztoh/.gitignore b/zero_to_one_hundred/tests/test_ztoh/.gitignore deleted file mode 100644 index f149560..0000000 --- a/zero_to_one_hundred/tests/test_ztoh/.gitignore +++ /dev/null @@ -1 +0,0 @@ -repo/** diff --git a/zero_to_one_hundred/tests/test_ztoh/resources/map.yaml b/zero_to_one_hundred/tests/test_ztoh/resources/map.yaml deleted file mode 100644 index 67061b6..0000000 --- a/zero_to_one_hundred/tests/test_ztoh/resources/map.yaml +++ /dev/null @@ -1,4 +0,0 @@ -type: ztoh-map -repo: - path: "./0to100" - map_md: "toc.md" diff --git a/zero_to_one_hundred/tests/test_ztoh/resources/map_sorted_0.yaml b/zero_to_one_hundred/tests/test_ztoh/resources/map_sorted_0.yaml deleted file mode 100644 index e4d64bf..0000000 --- a/zero_to_one_hundred/tests/test_ztoh/resources/map_sorted_0.yaml +++ /dev/null @@ -1,5 +0,0 @@ -type: ztoh-map -repo: - path: "./0to100" - map_md: "toc.md" - sorted: "abc" # oder alph \ No newline at end of file diff --git a/zero_to_one_hundred/tests/test_ztoh/resources/map_sorted_1.yaml b/zero_to_one_hundred/tests/test_ztoh/resources/map_sorted_1.yaml deleted file mode 100644 index 8f15c89..0000000 --- a/zero_to_one_hundred/tests/test_ztoh/resources/map_sorted_1.yaml +++ /dev/null @@ -1,5 +0,0 @@ -type: ztoh-map -repo: - path: "./0to100" - map_md: "toc.md" - sorted: "00:00:00" # order by modified date \ No newline at end of file diff --git a/zero_to_one_hundred/tests/test_ztoh/resources/unsupported_map.yaml b/zero_to_one_hundred/tests/test_ztoh/resources/unsupported_map.yaml deleted file mode 100644 index 6b30498..0000000 --- a/zero_to_one_hundred/tests/test_ztoh/resources/unsupported_map.yaml +++ /dev/null @@ -1,4 +0,0 @@ -type: not-a-map -configs: - path: "./repo" - some_field: true diff --git a/zero_to_one_hundred/tests/tests_sb/resources/map.yaml b/zero_to_one_hundred/tests/tests_sb/resources/map.yaml index 2e3d21b..c8d375a 100644 --- a/zero_to_one_hundred/tests/tests_sb/resources/map.yaml +++ b/zero_to_one_hundred/tests/tests_sb/resources/map.yaml @@ -1,14 +1,19 @@ type: safari-books-map -configs: - download_engine_path: "safaribooks/safaribooks.py" - download_engine_books_path: "safaribooks/Books" - download_books: false - oreilly_username: "username" - oreilly_userpassword: "userpassword" - split_pdf_pages: 0 +download_engine_path: "safaribooks/safaribooks.py" +download_engine_books_path: "safaribooks/Books" +download_books: false +split_pdf_pages: 0 +oreilly_secrets: + username: "username" + password: "userpassword" legend: - type: "sb" icons: - name: Book - icon: ":cyclone:" + icon: ":book:" regex: "978" + - name: Event + icon: ":floppy_disk:" + regex: "event" + - name: Course + icon: ":whale:" + regex: "course" \ No newline at end of file diff --git a/zero_to_one_hundred/tests/tests_sb/resources/unsupported_map.yaml b/zero_to_one_hundred/tests/tests_sb/resources/unsupported_map.yaml deleted file mode 100644 index 3ffdd56..0000000 --- a/zero_to_one_hundred/tests/tests_sb/resources/unsupported_map.yaml +++ /dev/null @@ -1,4 +0,0 @@ -type: not-a-map -configs: - path: "./repo" - finalized: true diff --git a/zero_to_one_hundred/tests/tests_sb/test_toc.py b/zero_to_one_hundred/tests/tests_sb/test_toc.py index 37fbad2..bcc5665 100644 --- a/zero_to_one_hundred/tests/tests_sb/test_toc.py +++ b/zero_to_one_hundred/tests/tests_sb/test_toc.py @@ -60,8 +60,10 @@ def test_as_mark_down( ### 2099/01/01 - 00:00:00 ## legend legendicons -Book -cyclone +Book :book: +Event :floppy_disk: +Course :whale: + | ISBN | img | `meta-contents` | `json-contents` | `status` | `icons` | |--- |--- |--- |--- |--- |--- | diff --git a/zero_to_one_hundred/tests/test_ztoh/__init__.py b/zero_to_one_hundred/tests/tests_zo/__init__.py similarity index 100% rename from zero_to_one_hundred/tests/test_ztoh/__init__.py rename to zero_to_one_hundred/tests/tests_zo/__init__.py diff --git a/zero_to_one_hundred/tests/test_ztoh/conftest.py b/zero_to_one_hundred/tests/tests_zo/conftest.py similarity index 100% rename from zero_to_one_hundred/tests/test_ztoh/conftest.py rename to zero_to_one_hundred/tests/tests_zo/conftest.py diff --git a/zero_to_one_hundred/tests/test_ztoh/resources/.gitignore b/zero_to_one_hundred/tests/tests_zo/resources/.gitignore similarity index 100% rename from zero_to_one_hundred/tests/test_ztoh/resources/.gitignore rename to zero_to_one_hundred/tests/tests_zo/resources/.gitignore diff --git a/zero_to_one_hundred/tests/test_ztoh/resources/datacamp_map.yaml b/zero_to_one_hundred/tests/tests_zo/resources/datacamp_map.yaml similarity index 71% rename from zero_to_one_hundred/tests/test_ztoh/resources/datacamp_map.yaml rename to zero_to_one_hundred/tests/tests_zo/resources/datacamp_map.yaml index c4950eb..106ae47 100644 --- a/zero_to_one_hundred/tests/test_ztoh/resources/datacamp_map.yaml +++ b/zero_to_one_hundred/tests/tests_zo/resources/datacamp_map.yaml @@ -1,9 +1,9 @@ -type: ztoh-map +type: zero-to-one-hundred-map repo: path: "./0to100" - map_md: "toc.md" + idx_id: "toc.md" + idx_sort: "00:00:00" # order by modified date legend: - type: "datacamp" icons: - name: Project icon: ":cyclone:" diff --git a/zero_to_one_hundred/tests/test_ztoh/resources/gcp_map.yaml b/zero_to_one_hundred/tests/tests_zo/resources/gcp_map.yaml similarity index 79% rename from zero_to_one_hundred/tests/test_ztoh/resources/gcp_map.yaml rename to zero_to_one_hundred/tests/tests_zo/resources/gcp_map.yaml index d2a5b91..95217fb 100644 --- a/zero_to_one_hundred/tests/test_ztoh/resources/gcp_map.yaml +++ b/zero_to_one_hundred/tests/tests_zo/resources/gcp_map.yaml @@ -1,9 +1,9 @@ -type: ztoh-map +type: zero-to-one-hundred-map repo: path: "./0to100" - map_md: "toc.md" + idx_id: "toc.md" + idx_sort: "00:00:00" # order by modified date legend: - type: "gcp" icons: - name: Path icon: ":cyclone:" diff --git a/zero_to_one_hundred/tests/tests_zo/resources/map.yaml b/zero_to_one_hundred/tests/tests_zo/resources/map.yaml new file mode 100644 index 0000000..5396a2e --- /dev/null +++ b/zero_to_one_hundred/tests/tests_zo/resources/map.yaml @@ -0,0 +1,4 @@ +type: zero-to-one-hundred-map +repo: + path: "./0to100" + idx_id: "toc.md" diff --git a/zero_to_one_hundred/tests/tests_zo/resources/map_sorted_0.yaml b/zero_to_one_hundred/tests/tests_zo/resources/map_sorted_0.yaml new file mode 100644 index 0000000..6f91948 --- /dev/null +++ b/zero_to_one_hundred/tests/tests_zo/resources/map_sorted_0.yaml @@ -0,0 +1,5 @@ +type: zero-to-one-hundred-map +repo: + path: "./0to100" + idx_id: "toc.md" + idx_sort: "abc" # order by alpha \ No newline at end of file diff --git a/zero_to_one_hundred/tests/tests_zo/resources/map_sorted_1.yaml b/zero_to_one_hundred/tests/tests_zo/resources/map_sorted_1.yaml new file mode 100644 index 0000000..59f223b --- /dev/null +++ b/zero_to_one_hundred/tests/tests_zo/resources/map_sorted_1.yaml @@ -0,0 +1,5 @@ +type: zero-to-one-hundred-map +repo: + path: "./0to100" + idx_id: "toc.md" + idx_sort: "00:00:00" # order by modified date \ No newline at end of file diff --git a/zero_to_one_hundred/tests/tests_zo/resources/unsupported_map.yaml b/zero_to_one_hundred/tests/tests_zo/resources/unsupported_map.yaml new file mode 100644 index 0000000..a2167ce --- /dev/null +++ b/zero_to_one_hundred/tests/tests_zo/resources/unsupported_map.yaml @@ -0,0 +1 @@ +type: unsupported-map diff --git a/zero_to_one_hundred/tests/test_ztoh/test_create_section_processor.py b/zero_to_one_hundred/tests/tests_zo/test_create_section_processor.py similarity index 100% rename from zero_to_one_hundred/tests/test_ztoh/test_create_section_processor.py rename to zero_to_one_hundred/tests/tests_zo/test_create_section_processor.py diff --git a/zero_to_one_hundred/tests/test_ztoh/test_done_section_processor.py b/zero_to_one_hundred/tests/tests_zo/test_done_section_processor.py similarity index 100% rename from zero_to_one_hundred/tests/test_ztoh/test_done_section_processor.py rename to zero_to_one_hundred/tests/tests_zo/test_done_section_processor.py diff --git a/zero_to_one_hundred/tests/test_ztoh/test_help_processor.py b/zero_to_one_hundred/tests/tests_zo/test_help_processor.py similarity index 65% rename from zero_to_one_hundred/tests/test_ztoh/test_help_processor.py rename to zero_to_one_hundred/tests/tests_zo/test_help_processor.py index 3e36689..6880e5f 100644 --- a/zero_to_one_hundred/tests/test_ztoh/test_help_processor.py +++ b/zero_to_one_hundred/tests/tests_zo/test_help_processor.py @@ -2,6 +2,6 @@ def test_process(get_factory): - actual: HelpProcessor = get_factory.get_processor([None, None, "help"]) + actual: HelpProcessor = get_factory.get_processor(["help"]) for p in actual: p.process() diff --git a/zero_to_one_hundred/tests/test_ztoh/test_map.py b/zero_to_one_hundred/tests/tests_zo/test_map.py similarity index 100% rename from zero_to_one_hundred/tests/test_ztoh/test_map.py rename to zero_to_one_hundred/tests/tests_zo/test_map.py diff --git a/zero_to_one_hundred/tests/test_ztoh/test_readme_md.py b/zero_to_one_hundred/tests/tests_zo/test_readme_md.py similarity index 100% rename from zero_to_one_hundred/tests/test_ztoh/test_readme_md.py rename to zero_to_one_hundred/tests/tests_zo/test_readme_md.py diff --git a/zero_to_one_hundred/tests/test_ztoh/test_refresh_links_processor.py b/zero_to_one_hundred/tests/tests_zo/test_refresh_links_processor.py similarity index 100% rename from zero_to_one_hundred/tests/test_ztoh/test_refresh_links_processor.py rename to zero_to_one_hundred/tests/tests_zo/test_refresh_links_processor.py diff --git a/zero_to_one_hundred/tests/test_ztoh/test_refresh_map_processor.py b/zero_to_one_hundred/tests/tests_zo/test_refresh_map_processor.py similarity index 100% rename from zero_to_one_hundred/tests/test_ztoh/test_refresh_map_processor.py rename to zero_to_one_hundred/tests/tests_zo/test_refresh_map_processor.py diff --git a/zero_to_one_hundred/tests/test_ztoh/test_section.py b/zero_to_one_hundred/tests/tests_zo/test_section.py similarity index 100% rename from zero_to_one_hundred/tests/test_ztoh/test_section.py rename to zero_to_one_hundred/tests/tests_zo/test_section.py diff --git a/zero_to_one_hundred/tests/test_ztoh/test_validator.py b/zero_to_one_hundred/tests/tests_zo/test_validator.py similarity index 100% rename from zero_to_one_hundred/tests/test_ztoh/test_validator.py rename to zero_to_one_hundred/tests/tests_zo/test_validator.py diff --git a/zero_to_one_hundred/tests/test_ztoh/test_ztoh_config_map.py b/zero_to_one_hundred/tests/tests_zo/test_ztoh_config_map.py similarity index 94% rename from zero_to_one_hundred/tests/test_ztoh/test_ztoh_config_map.py rename to zero_to_one_hundred/tests/tests_zo/test_ztoh_config_map.py index 4472d90..9ce55ef 100644 --- a/zero_to_one_hundred/tests/test_ztoh/test_ztoh_config_map.py +++ b/zero_to_one_hundred/tests/tests_zo/test_ztoh_config_map.py @@ -17,7 +17,6 @@ def test_gcp_config_map(get_gcp_config_map: ZTOHConfigMap): assert actual.get_type == ZTOH_MAP assert actual.get_repo_path is not None assert actual.get_repo_map_md == "toc.md" - assert actual.get_legend_type == "gcp" assert actual.get_legend_icons == [ ZTOHConfigMap.LegendIcons("Path", ":cyclone:", "path"), ZTOHConfigMap.LegendIcons("Lab", ":floppy_disk:", "lab"), @@ -32,7 +31,6 @@ def test_datacamp_config_map(get_datacamp_config_map: ZTOHConfigMap): assert actual.get_type == ZTOH_MAP assert actual.get_repo_path is not None assert actual.get_repo_map_md == "toc.md" - assert actual.get_legend_type == "datacamp" assert actual.get_legend_icons == [ ZTOHConfigMap.LegendIcons("Project", ":cyclone:", "project"), ZTOHConfigMap.LegendIcons("Tutorial", ":floppy_disk:", "tutorial"), @@ -42,7 +40,7 @@ def test_datacamp_config_map(get_datacamp_config_map: ZTOHConfigMap): def test_unsupported_config_map(get_unsupported_config_map: ZTOHConfigMap): actual = get_unsupported_config_map - assert actual.get_type == "not-a-map" + assert actual.get_type == "unsupported-map" def test_config_map_sorted_0(get_config_map_sorted_0: ZTOHConfigMap): diff --git a/zero_to_one_hundred/tests/test_ztoh/test_ztoh_factory.py b/zero_to_one_hundred/tests/tests_zo/test_ztoh_factory.py similarity index 100% rename from zero_to_one_hundred/tests/test_ztoh/test_ztoh_factory.py rename to zero_to_one_hundred/tests/tests_zo/test_ztoh_factory.py diff --git a/zero_to_one_hundred/tests/test_ztoh/test_ztoh_factory_provider.py b/zero_to_one_hundred/tests/tests_zo/test_ztoh_factory_provider.py similarity index 100% rename from zero_to_one_hundred/tests/test_ztoh/test_ztoh_factory_provider.py rename to zero_to_one_hundred/tests/tests_zo/test_ztoh_factory_provider.py diff --git a/zero_to_one_hundred/validator/validator.py b/zero_to_one_hundred/validator/validator.py index ff787f2..452ca07 100644 --- a/zero_to_one_hundred/validator/validator.py +++ b/zero_to_one_hundred/validator/validator.py @@ -23,11 +23,10 @@ def validate_args(cls, args): parser = argparse.ArgumentParser() parser.add_argument("cmd", type=str, nargs="?", default=None) parser.add_argument("p1", type=str, nargs="?", default=None) - try: - args = parser.parse_args(args[2:]) # skip fn - cmd = args.cmd - p1 = args.p1 - return cmd, p1 - except Exception: - pass - return None, None + parser.add_argument("p2", type=str, nargs="?", default=None) + + args = parser.parse_args(args) # skip fn + cmd = args.cmd + p1 = args.p1 + p2 = args.p2 + return cmd, p1, p2 diff --git a/zero_to_one_hundred/views/__init__.py b/zero_to_one_hundred/views/__init__.py new file mode 100644 index 0000000..e69de29