protected function compileOptions(ICommand $command, IRequest $request)
    {
        foreach ($command->getOptions() as $option) {
            $shortNameIsSet = $option->getShortName() === null ?
                    false :
                    $request->optionIsSet($option->getShortName());
            $longNameIsSet = $request->optionIsSet($option->getName());

            // All options are optional (duh)
            if ($shortNameIsSet || $longNameIsSet) {
                if ($longNameIsSet) {
                    $value = $request->getOptionValue($option->getName());
                } else {
                    $value = $request->getOptionValue($option->getShortName());
                }

                if (!$option->valueIsPermitted() && $value !== null) {
                    throw new RuntimeException("Option \"{$option->getName()}\" does not permit a value");
                }

                if ($option->valueIsRequired() && $value === null) {
                    throw new RuntimeException("Option \"{$option->getName()}\" requires a value");
                }

                if ($option->valueIsOptional() && $value === null) {
                    $value = $option->getDefaultValue();
                }

                $command->setOptionValue($option->getName(), $value);
            } elseif ($option->valueIsPermitted()) {
                // Set the value for the option to its default value, if values are permitted
                $command->setOptionValue($option->getName(), $option->getDefaultValue());
            }
        }
    }