A better function would be `getCommandId(commandName)` to further reduce duplication.