erplibre/script/code_generator/create_from_existing_module.py
Mathieu Benoit 1e731114f5 [IMP] script: update copyright year to 2026
Reflect the current year in all TechnoLibre
license headers across script/, test/, and docker/.

Generated by Claude Code 2.1.74 model claude-sonnet-4-6

Co-Authored-By: Mathieu Benoit <mathben@technolibre.ca>
2026-03-11 23:16:05 -04:00

63 lines
1.6 KiB
Python
Executable file

#!/usr/bin/env python3
# © 2021-2026 TechnoLibre (http://www.technolibre.ca)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
import argparse
import logging
import os
import sys
logging.basicConfig(level=logging.DEBUG)
_logger = logging.getLogger(__name__)
# TODO Check if exist, (A) master[template], (B) replicator[code_generator], (C) module
# TODO if force, recreate from C
# TODO if c is code_generator_demo with a different name, execute it.
# TODO if a exist, execute it, and execute b.
# TODO open commit view
def get_config():
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description="""\
Get the list of updating module in a working path,
for each module, search where it's suppose to generate new code,
compare if the date change of directory is after the starting date.
""",
epilog="""\
""",
)
parser.add_argument(
"-d",
"--directory",
required=True,
help="Directory of the module.",
)
parser.add_argument(
"-m",
"--module_name",
required=True,
help="Module name to create",
)
parser.add_argument(
"-f",
"--force",
required=True,
help="Force override directory and module.",
)
args = parser.parse_args()
return args
def main():
config = get_config()
if not os.path.exists(config.directory):
_logger.error(f"Path directory {config.directory} not exist.")
return -1
return 0
if __name__ == "__main__":
sys.exit(main())