ShadowTheAge / yafc

Powerful Factorio calculator/analyser that works with mods
GNU General Public License v3.0
161 stars 50 forks source link

Open files from command line #206

Open DaleStan opened 1 year ago

DaleStan commented 1 year ago

I kept expecting to be able to double-click YAFC files to get them to open, so I made that happen.

veger commented 1 year ago

It might be better to add some flag like --load, so it would be possible to extend the command line actions in a later stage if needed. On the other hand, those flags could be added (breaking change) when/if needed in the future... :smile:

DaleStan commented 1 year ago

I don't like that because it makes it harder for Windows users to set up the file associations. Most Unixy executables work the same way; neither vim nor emacs require --load before the filename.

That said, I should allow and ignore --, so a defensive script can do yafc -- $1 or yafc -- %1 and not worry about people who want to open a file named --export-page=Default.yafc. What appears to be the best available getopt-compatible library doesn't support this yet, so I'll make a PR there and come back to this.