Created
September 22, 2016 18:41
-
-
Save anonymous/6a15e9cde1848e551eac63c4a4561261 to your computer and use it in GitHub Desktop.
swap out KEY and TOKEN and any lists from your own boards you would like to use and put this in your /usr/local/bin or anything in your $PATH variable (for instance, I have ~/bin in mine, so I saved this as ~/bin/trello). forked from
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/bash | |
if [ $# -ne 2 ] | |
then | |
echo "Usage is: $0: <shorthand> \"<title>\""; | |
echo "For example: trello misc 'Do this and that'"; | |
echo -e "\033[1m"; #bold header row | |
echo "| Shorthand | Board | List"; | |
echo -ne "\033[0m"; | |
echo "----------------------------------------"; #separate header row from table | |
echo "| misc | Someday | Misc"; | |
echo "| in | INbasket | APIed in?"; | |
echo "| tabs | INbasket | Tabs"; | |
# echo "| misc | | "; | |
exit 1 | |
fi | |
case "$1" in | |
'in') | |
listid='57cddb24b4f2b1a4b1a4b1a4';; | |
'tabs') | |
listid='57cddb24b4f2b1a4b1a4b1a4';; | |
'misc') | |
listid='57cddb24b4f2b1a4b1a4b1a4';; | |
*) | |
echo 'Bad shorthand, see trello -?'; | |
exit 0;; | |
esac | |
# replace spaces in name with + (or else http call will fail) | |
name=$2 | |
safe_name=$(echo $name|tr ' ' '+'|sed s/\&/%26/g) | |
data="name="$safe_name"&due=null&idList="$listid"&token=TOKEN&key=KEY" | |
# The following curl will throw away response json, and display just status code (200 == two thumbs up!) | |
curl -s -o /dev/null -w "%{http_code}\\n" --data "$data" https://api.trello.com/1/cards |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment