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

Allow optional strings in --output patterns #210

Open
ilikepeaches opened this issue Dec 11, 2024 · 1 comment
Open

Allow optional strings in --output patterns #210

ilikepeaches opened this issue Dec 11, 2024 · 1 comment

Comments

@ilikepeaches
Copy link

Default file names include certain constant elements only if a certain data field is populated. For instance, the default NY Times filenames only include " - " after the date string on Sundays, when the puzzle actually has a title.

NY Times - 20241207.puz
NY Times - 20241208 - Just for Fun.puz

but filename: '%prefix - %Y%m%d %a - %title' in xword-dl.yaml or -o '%prefix - %Y%m%d %a - %title' on the command line produce

NY Times - 20241207 Sat - .puz
NY Times - 20241208 Sun - Just for Fun.puz

The dividing elements preceding the title are included even when there is no title.

Could you please replicate that feature for user-defined patterns, or, if it already exists, share with me the syntax for doing so, and perhaps make that syntax easier to discover?

I would imagine a grouping system, perhaps with delimiters around portions of the pattern that should only be included if the relevant token is populated, something like -o '%prefix - %Y%m%d %a''( - %title)'

@thisisparker
Copy link
Owner

This is a good idea! I could probably simplify the way the delimiter omissions work, too. I'll look into implementing this.

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

No branches or pull requests

2 participants