This repository has been archived by the owner on Dec 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
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
8 changed files
with
289 additions
and
109 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from dataclasses import dataclass, field | ||
import cappa | ||
from typing import Any, Literal | ||
from typing_extensions import Annotated | ||
import rich | ||
|
||
|
||
from .commands import Make, HtmxExt | ||
|
||
|
||
|
||
|
||
@cappa.command(help="Download the latest version of htmx.") | ||
class Htmx: | ||
pass | ||
|
||
|
||
|
||
@cappa.command(help="Clean up all migrations.") | ||
class RmMigrations: | ||
pass | ||
|
||
|
||
@cappa.command(help="Remove poetry from your project.") | ||
class RmPoetry: | ||
pass | ||
|
||
|
||
@cappa.command(help="Run multiple processes in parallel.") | ||
class Work: | ||
pass | ||
|
||
|
||
@cappa.command(help="Update or create a .env file from a .env.template file.") | ||
class WriteEnv: | ||
pass | ||
|
||
|
||
@cappa.command( | ||
help="Initialize a new django project using the fuzzy-couscous project template.", | ||
description="""This is a wrapper around the django-admin startproject command using my custom project template at | ||
https://github.com/Tobi-De/fuzzy-couscous. This cli also includes some additional commands to make setting up | ||
a new project faster. | ||
""", | ||
) | ||
class Toji: | ||
subcommand: cappa.Subcommands[ | ||
Make | Htmx | HtmxExt | RmMigrations | RmPoetry | Work | WriteEnv | ||
] | ||
|
||
|
||
def main(): | ||
cappa.invoke(Toji) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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,52 @@ | ||
from typing import Any | ||
import cappa | ||
|
||
from pathlib import Path | ||
|
||
THIRD_PARY_REGISTRY = { | ||
"htmx-template": { | ||
"file": "https://raw.githubusercontent.com/KatrinaKitten/htmx-template/master/htmx-template.min.js", | ||
"url": "https://github.com/KatrinaKitten/htmx-template", | ||
}, | ||
"hx-take": { | ||
"file": "https://github.com/oriol-martinez/hx-take/blob/main/dist/hx-take.min.js", | ||
"url": "https://github.com/oriol-martinez/hx-take", | ||
}, | ||
} | ||
|
||
|
||
|
||
@cappa.command(help="Download one of htmx extensions.") | ||
class HtmxExt: | ||
name: str | None = cappa.Arg( | ||
None, | ||
help="The name of the extension to download.", | ||
choices=THIRD_PARY_REGISTRY.keys(), | ||
) | ||
version: str = cappa.Arg( | ||
"latest", | ||
short="-v", | ||
long="--version", | ||
help="The version of htmx to use to look for the extension.", | ||
) | ||
output : Path = cappa.Arg(default=Path.cwd(), help="The directory to write the downloaded file to.", short="-o", long="--output") | ||
|
||
|
||
def __call__(self) -> None: | ||
if self.name: | ||
self.download(self.name) | ||
else: | ||
self.list_all() | ||
|
||
|
||
def download(self): | ||
pass | ||
|
||
def list_all(self): | ||
pass | ||
|
||
@classmethod | ||
def official_regitry(cls, htmx_version: str): | ||
base_url = f"https://unpkg.com/htmx.org@{htmx_version}/dist/ext/" | ||
|
||
|
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
Oops, something went wrong.