# File lib/pry/default_commands/documentation.rb, line 159
        def perform_gist
          type_map = { :ruby => "rb", :c => "c", :plain => "plain" }

          if self.content =~ /\A\s*\z/
            raise CommandError, "Found no code to gist."
          end

          # prevent Gist from exiting the session on error
          begin
            extname = opts.present?(:file) ? ".#{gist_file_extension(opts[:f])}" : ".#{type_map[self.code_type]}"

            if opts.present?(:lines)
              self.content = restrict_to_lines(content, opts[:l])
            end

            link = Gist.write([:extension => extname,
                               :input => self.content],
                              !opts[:p])
          rescue SystemExit
          end

          if link
            Gist.copy(link)
            output.puts "Gist created at #{link} and added to clipboard."
          end
        end