private function parseFlag($flag)
    {
        $flag    = trim($flag);
        $pattern = '/^'.// Match start of string
            '('.// Start Group
                '(?<flag>(?:-\w|--\w[\w-]+))'.// Match Group <flag>
                '(?<enable>\+)?'.//Enable option by default (useful for creating special commands)
            ')'.// End Group
            '('.// Start Group
                '(?<can_have_value>=)?'.// Match Group <can_have_value>
                '(?<can_have_multiple_values>\*)?'.// Match Group <can_have_multiple_values>
                '(?<values>'.// Match Group <values>
                    '(?(<can_have_multiple_values>)'.// If <can_have_multiple_values>
                        '(\w+,)*\w+|'.// Match multiple comma-separated values
                        '(?(<can_have_value>)'.// Else if <can_have_value>
                            '\w+'.// Match only a single value
                        ')'.// End if <can_have_value>
                    ')'.// End if <can_have_multiple_values>
                ')?'.// End Group <values>
            ')?'.// End Group
            '('.// Start Group
                '\s+:\s+'.// [space] followed by ':' followed by [space]
                '(?<description>.+)'.// Match Group <description>
            ')?'.// End Group
            '$/'; // Match end of string

        $matches = [];
        $result  = preg_match($pattern, $flag, $matches);

        if ($result === 0 || $result === false) {
            throw new LogicException("[$flag] is improperly formatted for a shell option.");
        }

        // Set flag
        $parsedFlag['flag'] = null;
        if (isset($matches['flag'])) {
            $parsedFlag['flag'] = $matches['flag'];
        }

        // Set enable
        $parsedFlag['enable'] = false;
        if (! empty($matches['enable'])) {
            $parsedFlag['enable'] = true;
        }

        // Set can have value
        $parsedFlag['can_have_value'] = false;
        if (! empty($matches['can_have_value'])) {
            $parsedFlag['can_have_value'] = true;
        }

        // Set can have multiple values
        $parsedFlag['can_have_multiple_values'] = false;
        if (! empty($matches['can_have_multiple_values'])) {
            $parsedFlag['can_have_multiple_values'] = true;
        }

        // Set the values
        $parsedFlag['values'] = [];
        if (! empty($matches['values']) && $parsedFlag['can_have_value']) {
            $parsedFlag['values'] = $matches['values'];

            if ($parsedFlag['can_have_multiple_values']) {
                $parsedFlag['values'] = explode(',', $matches['values']);
            }
        }

        // Set the description
        $parsedFlag['description'] = null;
        if (isset($matches['description'])) {
            $parsedFlag['description'] = $matches['description'];
        }

        return $parsedFlag;
    }