chubin / cheat.sh

the only cheat sheet you need
https://cheat.sh/
MIT License
38.14k stars 1.78k forks source link

Cite source at the end #173

Open josephernest opened 4 years ago

josephernest commented 4 years ago

Is there a way to have a last line with the source of the cheatsheet? Example:

user:~# curl cheat.sh/iptables

Answer:

# iptables
# Program that allows configuration of tables, chains and rules provided by the Linux kernel firewall.
# View chains, rules, and packet/byte counters for all tables:
sudo iptables -vnL
... # Restore iptables configuration from a file:
sudo iptables-restore < path/to/iptables_file
[Source: tldr pages]

Or

[Source: stackoverlow]

It would be helpful to know "hum ok, if I go on tldr.sh, will I see the same content, ... or maybe is this already the content from tldr.sh?"

chubin commented 4 years ago

Yes, it is a fair idea.

We already have this for the answers fetched from StackOverflow:

$ curl cheat.sh/python/read+json+file
#  python - Parsing values from a JSON file?
#  
...
import json
from pprint import pprint

with open('data.json') as f:
    data = json.load(f)

pprint(data)

#  With data, you can now also find values like so:

data["maps"][0]["id"]
data["masks"]["id"]
data["om_points"]

#  Try those out and see if it starts to make sense.
#  
#  [Justin Peel] [so/q/2835559] [cc by-sa 3.0]

But we need the same for all cheat sheets. And even more than that, if we have the same page in several upstreams, we should show all of them:

$ curl cheat.sh/ls
[tldr]
....
[cheat]
...
[cheat.sheets]
....
chubin commented 4 years ago

See also: #147

MinmoTech commented 1 year ago

I'd like to bump this as sources would be super useful when answers are sources from StackOverflow