diff --git a/objects/__init__.py b/objects/__init__.py index 03fc3ab..4758ff1 100644 --- a/objects/__init__.py +++ b/objects/__init__.py @@ -1,23 +1,25 @@ -"""Top-level package for RP To-Do.""" -# rptodo/__init__.py +# The MIT License (MIT) +# +# Copyright (c) 2024 Aliaksei Bialiauski +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +import pkg_resources -__app_name__ = "rptodo" -__version__ = "0.1.0" - -( - SUCCESS, - DIR_ERROR, - FILE_ERROR, - DB_READ_ERROR, - DB_WRITE_ERROR, - JSON_ERROR, - ID_ERROR, -) = range(7) - -ERRORS = { - DIR_ERROR: "config directory error", - FILE_ERROR: "config file error", - DB_READ_ERROR: "database read error", - DB_WRITE_ERROR: "database write error", - ID_ERROR: "to-do id error", -} +name = "samples-filter" +version = pkg_resources.get_distribution("samples-filter").version diff --git a/objects/__main__.py b/objects/__main__.py index f42c595..4ad0988 100644 --- a/objects/__main__.py +++ b/objects/__main__.py @@ -1,10 +1,30 @@ -"""RP To-Do entry point script.""" -# rptodo/__main__.py +# The MIT License (MIT) +# +# Copyright (c) 2024 Aliaksei Bialiauski +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +from objects import cli, name -from objects import cli, __app_name__ def main(): - cli.app(prog_name=__app_name__) + cli.app(prog_name=name) + if __name__ == "__main__": main() diff --git a/objects/cli.py b/objects/cli.py index f3648ba..568fcf9 100644 --- a/objects/cli.py +++ b/objects/cli.py @@ -1,19 +1,46 @@ -"""This module provides the RP To-Do CLI.""" -# rptodo/cli.py - +# The MIT License (MIT) +# +# Copyright (c) 2024 Aliaksei Bialiauski +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. from typing import Optional import typer -from objects import __app_name__, __version__ +from objects import name, version app = typer.Typer() + +# @todo #1:45min Add support for --repositories and --out parameter. +# We should add support to our cli to handle two options: --repositories, +# and --out. Both indicate the name of the file to read/create. +# @todo #1:25min Clean parameters that we don't need. +# Let's remove parameters that we don't really need in this cli. +# Less parameters we will have, the better. +# Don't forget to remove this puzzle. def _version_callback(value: bool) -> None: if value: - typer.echo(f"{__app_name__} v{__version__}") + typer.echo(f"{name} v{version}") raise typer.Exit() + @app.callback() def main( version: Optional[bool] = typer.Option(