public function menu($items, $default = null, $title = 'Choose an item')
    {
        if (isset($items[$default]) && strpos($title, '[') === false) {
            $title .= ' [default: ' . $items[$default] . ']';
        }

        $this->line(sprintf('%s: ', $title));

        $i = 1;
        $keys = array();

        foreach ($items as $key => $item) {
            $keys[$i] = $key;
            $this->line(sprintf('  %d. %s', $i, $item));
            $i++;
        }

        $selected = $this->in();

        if ($selected === '') {
            return $default;
        }

        if (isset($keys[$selected])) {
            return $keys[$selected];
        }

        return $selected;
    }