gnachman / iterm2-website

Website for iTerm2
http://iterm2.com/
GNU General Public License v2.0
81 stars 65 forks source link

add a function for imgcat + url #46

Closed hellovictorlee closed 6 years ago

hellovictorlee commented 7 years ago

curl I utilize curl to check if the file can be downloaded from the provided url. If yes, downloads it in the path "~/.iterm2/image_collection" and create a list.txt. list.txt file is used to check if the user has downloads file from the url. Users can save time if they have already downloaded the file from the url.

md5 I use the value of each file's md5 as its name. If I download a new file whose md5 value is identical to the file user downloaded, in practical, the new file is the same file. Therefore, we only need to store one.

gnachman commented 7 years ago

This is a nice addition, but I think this tool should not perform caching. It's unexpected and has the side effect of using unbounded amounts of disk space. It's also dangerous to perform network requests, so there should be a clear user intent before invoking curl. I'd suggest doing that only if the command is like imgcat --url http://example.com/image.gif.

gnachman commented 6 years ago

Merged with some small changes. Thanks1