A few more tips:
1. Depending on the language you're using, look for a library to take care of the CLI for you; avoid implementing it yourself; it's not as easy as it looks.
2. Be aware of stdout and stderr, and their differences and purposes. If you're providing any output that will be parsed by some other scripts, put that and that alone in stdout and everything else such as progress bars, logging info, warnings and errors, even input prompts if you have them, goes in stderr.
3. If the purpose of your program is to output some specific info, don't provide an output flag, rather output that to stdout, and if the user wants it saved they have the power to redirect stdout to a file. That way they can run it without creating a file if they just want to see it once, and they can pipe it to other programs which simplifies scripting.