Skip to content

Commit 07b6627

Browse files
authored
updated how --outfilename works
1 parent 6b5840c commit 07b6627

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

db_diff/cli.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,14 @@ def cli(
170170

171171
# Set default output filename if needed
172172
if output == "jsonfile":
173+
timestamp = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
173174
if not output_file:
174-
timestamp = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
175175
output_file = f"{timestamp}_diffs.json"
176+
else:
177+
# Append the user-specified filename to the timestamp
178+
base_name = os.path.splitext(output_file)[0] # Remove extension if present
179+
output_file = f"{timestamp}_diffs_{base_name}.json"
180+
176181
if output_path:
177182
if not os.path.isdir(output_path):
178183
raise click.ClickException(f"Output path '{output_path}' does not exist or is not a directory.")

0 commit comments

Comments
 (0)