Created
January 20, 2011 14:59
-
-
Save seungwon0/788021 to your computer and use it in GitHub Desktop.
Simple shell script using commandlinefu.com API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# commandlinefu - Simple shell script using commandlinefu.com API | |
# | |
# All commands sorted by date: | |
# % commandlinefu | |
# | |
# All commands sorted by votes: | |
# % commandlinefu -v | |
# | |
# Search results for the query 'ssh' sorted by date: | |
# % commandlinefu ssh | |
# | |
# Search results for the query 'ssh' sorted by votes: | |
# % commandlinefu -v ssh | |
# | |
# You can learn more about commandlinefu.com API at the following link: | |
# http://www.commandlinefu.com/site/api | |
# | |
# Original script: | |
# http://commandlinefu.uservoice.com/forums/11102-general/suggestions/116596-provide-bash-client-to-integrate-site-into-cli | |
# | |
# Seungwon Jeong <[email protected]> | |
# | |
# Copyright (C) 2011 by Seungwon Jeong | |
set -e | |
if test "$1" = -v; then | |
sort=sort-by-votes | |
shift | |
fi | |
base_url=http://www.commandlinefu.com/commands | |
if test "$1"; then | |
query=$1 | |
base64=`echo -n $query | base64` | |
command_set=matching/$query/$base64 | |
else | |
command_set=browse | |
fi | |
if test "$sort"; then | |
command_set=$command_set/$sort | |
fi | |
format=plaintext | |
url=$base_url/$command_set/$format | |
if test -t 1; then | |
curl -s $url | source-highlight -s sh -f esc | less -R | |
else | |
curl -s $url | |
fi |
Hi,
Now, you have to use https
instead http
.
Thanks for sharing !
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you by any change know on how to get a DoFollow link in CommandlineFU website? If so could please concrete stamped me.