dansanderson / picotool

Tools and Python libraries for manipulating Pico-8 game files. http://www.lexaloffle.com/pico-8.php
MIT License
367 stars 46 forks source link

Have a remove comments option #27

Closed morningtoast closed 2 years ago

morningtoast commented 6 years ago

Have a flag that will only strip out comments and that's it. Leave everything else the way it is.

Removing comments is an easy way to get some compression headroom. I'm very generous with my comments and hate having to remove many of them as I'll forget everything when I go back to work on things much later in the future.

(Using luamin with my game still results in odd in-game behavior. Can't really isolate it yet but when I do, I'll put in another ticket.)

josefnpat commented 6 years ago

Here's my sed configs in RPIV

#Remove leading and trailing whitespace
sed -i 's/^[ \t]*//;s/[ \t]*$//' ${RAW}
#Remove all comments
sed -i 's:--.*$::g' ${RAW}
#Delete empty lines
sed -i '/^$/d' ${RAW}

Warning: This only handles single line comments, and will screw up multiline comments.

dansanderson commented 2 years ago

Implemented in 09f9ed3eb72485783260ee4bed24a99682e294cc. luamin now has a --keep-all-names command line flag.