Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow deleting all existing docs guides #1493

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions scripts/patterns-reorg/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,23 @@

import shutil
import json
from argparse import ArgumentParser
from pathlib import Path

from models import determine_redirects
from entries import TOP_LEVEL_ENTRIES


def create_parser() -> ArgumentParser:
parser = ArgumentParser()
parser.add_argument(
"--delete-existing",
action="store_true",
help="If true, delete the original guides.",
)
return parser


def write_guides_dir() -> None:
folder_path = Path("docs", "guides")
if folder_path.exists():
Expand All @@ -47,10 +58,20 @@ def write_redirects_file() -> None:
fp.write_text(text)


def delete_existing_guides() -> None:
for d in ["start", "run", "verify", "transpile", "build"]:
shutil.rmtree(Path("docs", d))


def main() -> None:
args = create_parser().parse_args()

write_guides_dir()
write_redirects_file()

if args.delete_existing:
delete_existing_guides()


if __name__ == "__main__":
main()
Loading