This feels like you are writing the logic that you wanted to avoid by using commander in the first place. Optimist handles the case of unspecified required options automatically, implementing more or less the same behavior you've written here.