Merge branch 'main' of ssh://git.publicmatt.com:23231/public/daily
This commit is contained in:
commit
990756969a
|
@ -1,7 +1,7 @@
|
|||
import click
|
||||
from pydanclick import from_pydantic
|
||||
|
||||
from . import hacker_news, weather
|
||||
from . import weather, hacker_news, git
|
||||
|
||||
|
||||
@click.group()
|
||||
|
@ -80,3 +80,6 @@ def tides(should_print: bool):
|
|||
for fields in data.get("predictions"):
|
||||
tide = Tide(**fields)
|
||||
print(f"{tide.t}: {tide.v} ({tide.type})")
|
||||
|
||||
|
||||
cli.add_command(git.cli)
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
import os
|
||||
import subprocess
|
||||
import os
|
||||
import click
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
import logging
|
||||
|
||||
|
||||
@click.command("commit-push")
|
||||
@click.option(
|
||||
"--repo-path", "-p", "repo_path", help="path to commit", default=Path().cwd()
|
||||
)
|
||||
def cli(repo_path):
|
||||
"""
|
||||
Commits and pushes changes in the specified Git repository.
|
||||
"""
|
||||
commit_message = f"{datetime.now().strftime('%Y-%m-%d')} daily publish"
|
||||
os.chdir(repo_path)
|
||||
|
||||
try:
|
||||
# Run git add (add all changes)
|
||||
subprocess.run(["git", "add", "."], check=True)
|
||||
|
||||
# Run git commit
|
||||
subprocess.run(["git", "commit", "-m", commit_message], check=True)
|
||||
|
||||
# Run git push
|
||||
subprocess.run(["git", "push"], check=True)
|
||||
|
||||
click.echo(
|
||||
f"changes have been committed and pushed to {repo_path} with message: {commit_message}"
|
||||
)
|
||||
logging.info("git pushed")
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
logging.warning(f"error occurred while running git command: {e}")
|
||||
click.echo(f"error occurred while running git command: {e}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cli()
|
12
uv.lock
12
uv.lock
|
@ -250,7 +250,7 @@ wheels = [
|
|||
|
||||
[[package]]
|
||||
name = "pydanclick"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "annotated-types" },
|
||||
|
@ -259,9 +259,9 @@ dependencies = [
|
|||
{ name = "pydantic-core" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/0d/6a/19de6c594daf490b3e1a9993c152e1db088981330717a241bb49854c08e1/pydanclick-0.4.0.tar.gz", hash = "sha256:866709df4e92d94d74c200f67438d929d83e608c0724a78b7cb1c781a71acc60", size = 20709 }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/63/da/f5636b1fcf9a70a2c6a02a5509ad52910a30a5adbecdd03a1d99c34036f1/pydanclick-0.5.0.tar.gz", hash = "sha256:3c2ed5b622e74e7ef034f740cdf0f979fab3858462f05a1e3f16a84f9d1b9bc1", size = 20882 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/6e/19/5bb0bdee221a444d95b762a4d0fc2fcdbbb1209c0038b89166f420bad666/pydanclick-0.4.0-py3-none-any.whl", hash = "sha256:acd9f4db2f2221c73e2272b420dc7ab4d74559373319fa293be12e7b1e9b7e29", size = 21969 },
|
||||
{ url = "https://files.pythonhosted.org/packages/0f/89/62a0f0fdcd9b552ddf97e2647dda8aa81a8b55663bb4771098e78b1bbadd/pydanclick-0.5.0-py3-none-any.whl", hash = "sha256:54bd385045b5b82c26bd0f2664daf2dde2843eec1e3b6ad61b3819c988b14366", size = 22166 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -319,15 +319,15 @@ wheels = [
|
|||
|
||||
[[package]]
|
||||
name = "pydantic-settings"
|
||||
version = "2.7.1"
|
||||
version = "2.8.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "pydantic" },
|
||||
{ name = "python-dotenv" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/73/7b/c58a586cd7d9ac66d2ee4ba60ca2d241fa837c02bca9bea80a9a8c3d22a9/pydantic_settings-2.7.1.tar.gz", hash = "sha256:10c9caad35e64bfb3c2fbf70a078c0e25cc92499782e5200747f942a065dec93", size = 79920 }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ca/a2/ad2511ede77bb424f3939e5148a56d968cdc6b1462620d24b2a1f4ab65b4/pydantic_settings-2.8.0.tar.gz", hash = "sha256:88e2ca28f6e68ea102c99c3c401d6c9078e68a5df600e97b43891c34e089500a", size = 83347 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/b4/46/93416fdae86d40879714f72956ac14df9c7b76f7d41a4d68aa9f71a0028b/pydantic_settings-2.7.1-py3-none-any.whl", hash = "sha256:590be9e6e24d06db33a4262829edef682500ef008565a969c73d39d5f8bfb3fd", size = 29718 },
|
||||
{ url = "https://files.pythonhosted.org/packages/c1/a9/3b9642025174bbe67e900785fb99c9bfe91ea584b0b7126ff99945c24a0e/pydantic_settings-2.8.0-py3-none-any.whl", hash = "sha256:c782c7dc3fb40e97b238e713c25d26f64314aece2e91abcff592fcac15f71820", size = 30746 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
Loading…
Reference in New Issue