[Manage] adds debug flag to enable database for debugging only

This commit is contained in:
HappyZ 2023-05-10 15:40:07 -07:00
parent 7458ae1033
commit a9d4f8e3d7
1 changed files with 6 additions and 0 deletions

View File

@ -184,6 +184,9 @@ def manage(args):
# Path to the lock file # Path to the lock file
lock_file = "/tmp/happysd_db.lock" lock_file = "/tmp/happysd_db.lock"
if args.debug:
db_path = "happysd_debug.db"
# Connect to the database (creates a new file if it doesn't exist) # Connect to the database (creates a new file if it doesn't exist)
conn = sqlite3.connect(db_path) conn = sqlite3.connect(db_path)
@ -244,6 +247,9 @@ def manage(args):
def main(): def main():
# Parse command-line arguments # Parse command-line arguments
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument(
"--debug", action="store_true", help="Enable debugging mode"
)
subparsers = parser.add_subparsers(dest="action", required=True) subparsers = parser.add_subparsers(dest="action", required=True)
# Sub-parser for the "create" action # Sub-parser for the "create" action