mirror of
https://github.com/JockeTF/fimfarchive.git
synced 2025-02-08 14:56:44 +01:00
Add commands package
This commit is contained in:
parent
ffe822f5d4
commit
8d0d738fd1
3 changed files with 82 additions and 0 deletions
30
fimfarchive/commands/__init__.py
Normal file
30
fimfarchive/commands/__init__.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
"""
|
||||
Command module.
|
||||
"""
|
||||
|
||||
|
||||
#
|
||||
# Fimfarchive, preserves stories from Fimfiction.
|
||||
# Copyright (C) 2015 Joakim Soderlund
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
from .base import Command
|
||||
|
||||
|
||||
__all__ = (
|
||||
'Command',
|
||||
)
|
51
fimfarchive/commands/base.py
Normal file
51
fimfarchive/commands/base.py
Normal file
|
@ -0,0 +1,51 @@
|
|||
"""
|
||||
Command base class.
|
||||
"""
|
||||
|
||||
|
||||
#
|
||||
# Fimfarchive, preserves stories from Fimfiction.
|
||||
# Copyright (C) 2015 Joakim Soderlund
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
__all__ = (
|
||||
'Command',
|
||||
)
|
||||
|
||||
|
||||
class Command(ABC):
|
||||
"""
|
||||
Command line interface for tasks.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def __call__(self, *args: str) -> int:
|
||||
"""
|
||||
Runs the command.
|
||||
|
||||
Args:
|
||||
*args: Command line arguments.
|
||||
|
||||
Returns:
|
||||
Application exit status.
|
||||
|
||||
Raises:
|
||||
SystemExit: If the arguments are invalid.
|
||||
"""
|
|
@ -26,6 +26,7 @@ import pytest
|
|||
|
||||
|
||||
MODULES = (
|
||||
'commands',
|
||||
'exceptions',
|
||||
'fetchers',
|
||||
'flavors',
|
||||
|
|
Loading…
Reference in a new issue