From ff45f836b3b8abc5e8bc72a937ec59a9f354166f Mon Sep 17 00:00:00 2001 From: Jakob Scheid Date: Thu, 9 Apr 2026 19:21:25 +0200 Subject: [PATCH] Add module cli --- src/jcloud_docsgen/cli.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/jcloud_docsgen/cli.py diff --git a/src/jcloud_docsgen/cli.py b/src/jcloud_docsgen/cli.py new file mode 100644 index 0000000..86b42b2 --- /dev/null +++ b/src/jcloud_docsgen/cli.py @@ -0,0 +1,37 @@ +# Copyright 2026 jCloud Services GbR + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +''' +The command line interface +''' + +__all__ = [ + 'main' +] + +import argparse +import pathlib +from .utils import ExistingDirectory + +def existing_directory(path: str, *args, **kwargs) -> pathlib.Path: + try: + return ExistingDirectory(path, *args, **kwargs) + except (FileNotFoundError, NotADirectoryError) as e: + raise argparse.ArgumentTypeError(f'{e.filename}{": " + e.args[1] if len(e.args) > 1 else ""}') + +def main() -> int: + argument_parser = argparse.ArgumentParser() + argument_parser.add_argument('project_directory', type = existing_directory, default = pathlib.Path('.'), help = 'The directory of the project') + args = argument_parser.parse_args() + return 0 \ No newline at end of file