Include the answer link in the output by default #152

Open
jericson opened this Issue Aug 15, 2016 · 1 comment

Projects

None yet

2 participants

@jericson

By default, answers provided by howdoi come from Stack Overflow, which has an attribution policy. It's pretty typical to include a comment with a link to the SO answer when using code. (Even this project follows that convention.) If you use the -l option, you get a link to the answer (and no code), but there's no way to get the link and the code.

My suggestion is to keep the -l option the same and add a URL to the default output. This would also make the multiple answer output more useful:

$ howdoi copy table lua -n 2
--- http://stackoverflow.com/questions/37565836/copy-table-elements-to-new-table ---
table.insert(MainTable, TempTable)

--- http://stackoverflow.com/questions/4535152/cloning-a-lua-table-in-lua-c-api ---
shallow_copy = function(tab)
    local retval = {}
    for k, v in pairs(tab) do
        retval[k] = v
    end
    return retval
end

I think that looks a lot better than "Answer 1" and "Answer 2".

(Disclosure: I work as a Community Manager [howdoi community manager] for Stack Overflow.)

@gleitz
Owner
gleitz commented Aug 15, 2016

Very nice suggestion, @jericson. I would be happy to accept a pull request with the URL included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment