Skeleton for commands

This commit is contained in:
einarf 2023-03-08 23:29:15 +01:00
parent 47d74a2ef7
commit 5f6b1cd7a3
9 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,9 @@
from .base import BaseCommand
class Command(BaseCommand):
"""Send an alert"""
name = "alert"
def run(self):
print("Alert!")

View File

@ -0,0 +1,9 @@
from .base import BaseCommand
class Command(BaseCommand):
"""Backup a directory"""
name = "backup"
def run(self):
print("Backup!")

View File

@ -0,0 +1,12 @@
from restic_compose_backup.config import Config
class BaseCommand:
"""Base class for all commands"""
name = "base"
def __init__(self):
self.config = Config()
def run(self):
raise NotImplementedError

View File

@ -0,0 +1,9 @@
from .base import BaseCommand
class Command(BaseCommand):
"""Cleanup old snapshots"""
name = "cleanup"
def run(self):
print("Cleanup!")

View File

@ -0,0 +1,9 @@
from .base import BaseCommand
class Command(BaseCommand):
"""Manage crontab"""
name = "crontab"
def run(self):
print("Crontab!")

View File

@ -0,0 +1,9 @@
from .base import BaseCommand
class Command(BaseCommand):
"""List snapshots"""
name = "snapshots"
def run(self):
print("Snapshots!")

View File

@ -0,0 +1,9 @@
from .base import BaseCommand
class Command(BaseCommand):
"""Show status"""
name = "status"
def run(self):
print("Status!")

View File

@ -0,0 +1,9 @@
from .base import BaseCommand
class Command(BaseCommand):
"""Test a command"""
name = "test"
def run(self):
print("Test!")

View File

@ -0,0 +1,9 @@
from .base import BaseCommand
class Command(BaseCommand):
"""Show version"""
name = "version"
def run(self):
print("Version!")