Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix traceback when not passing file to -o option #698

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

ericwb
Copy link
Contributor

@ericwb ericwb commented Nov 13, 2024

If precli-init is run without an argument for the -o, it will fail with a traceback due to the argparse.FileType not allowing a default of a str for a file name.

This change does the logic of detecting and opening files manually on its own. It will present an error if the file already exists to prevent overwriting. Except in the case where the file is pyproject.toml and the settings will be appended to it.

If precli-init is run without an argument for the -o,
it will fail with a traceback due to the argparse.FileType
not allowing a default of a str for a file name.

This change does the logic of detecting and opening files
manually on its own. It will present an error if the file
already exists to prevent overwriting. Except in the case
where the file is pyproject.toml and the settings will be
appended to it.

Signed-off-by: Eric Brown <eric.brown@securesauce.dev>
@ericwb ericwb force-pushed the precli-init_output branch from 362dfe0 to dc9eedf Compare November 13, 2024 23:49
@ericwb ericwb merged commit 0d609cb into securesauce:main Nov 13, 2024
20 checks passed
@ericwb ericwb deleted the precli-init_output branch November 13, 2024 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant