Skip to content

Commit 796034a

Browse files
authored
updated base filename
1 parent 07b6627 commit 796034a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

db_diff/cli.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,14 @@ def cli(
171171
# Set default output filename if needed
172172
if output == "jsonfile":
173173
timestamp = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
174+
175+
# Extract base filenames without extensions for the comparison files
176+
prev_basename = os.path.splitext(os.path.basename(previous))[0]
177+
curr_basename = os.path.splitext(os.path.basename(current))[0]
178+
default_name = f"{timestamp}_diffs_{prev_basename}__VS__{curr_basename}.json"
179+
174180
if not output_file:
175-
output_file = f"{timestamp}_diffs.json"
181+
output_file = default_name
176182
else:
177183
# Append the user-specified filename to the timestamp
178184
base_name = os.path.splitext(output_file)[0] # Remove extension if present

0 commit comments

Comments
 (0)