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

feat: guess output format from output file extension #197

Merged
merged 1 commit into from Aug 25, 2021
Merged

feat: guess output format from output file extension #197

merged 1 commit into from Aug 25, 2021

Conversation

nicfb
Copy link
Contributor

@nicfb nicfb commented Aug 17, 2021

guess output format based on output file extension

check for empty output file

default to .txt if no file extension provided

add tests

update man page

Q A
Bug fix? no
New feature? yes
Related issues Fix #160
Has BC-break no
License GNU AGPL-v3

Checklist:

  • I have updated the manpages

This PR makes it so the --output argument optional. If it is not given, the file extension from the output file will be used to guess the requested format.

Copy link
Member

@Deuchnord Deuchnord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! That's a great job! 😄
Don't forget to fix the CI (make black messages) 🙂

_kosmorro/main.py Show resolved Hide resolved
_kosmorro/exceptions.py Outdated Show resolved Hide resolved
_kosmorro/main.py Outdated Show resolved Hide resolved
manpage/kosmorro.1.md Outdated Show resolved Hide resolved
@nicfb
Copy link
Contributor Author

nicfb commented Aug 22, 2021

I think I have addressed all of your comments. Let me know if there's anything else you see that needs fixing!

Copy link
Member

@Deuchnord Deuchnord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
Just a few changes and all will be OK for a merge 😄

_kosmorro/exceptions.py Outdated Show resolved Hide resolved
_kosmorro/main.py Outdated Show resolved Hide resolved
_kosmorro/main.py Outdated Show resolved Hide resolved
guess output format based on output file extension

check for empty output file

default to .txt if no file extension provided

change default output format back to txt

add tests

update man page

fix default output format

directly return output dumper

use keys from dumpers in key error message

fix man pages

prevent output format from being overridden

use first dumper key as default format

update messages and formatting

update help message for format argument

specify list type in InvalidOutputFormat exception

make default output format more apparent

update messages
@Deuchnord
Copy link
Member

Thank you!
I'll just make some tests as soon as possible and then merge it :)

@Deuchnord
Copy link
Member

It's all good for me, just caught a little bug when exporting to JSON without giving a position, but it's not related to this PR and should be fixed in a 0.10.2 version, so we can merge this!

Thank you for this amazing work! 😄

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.

None yet

2 participants