-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrello
More file actions
executable file
·47 lines (42 loc) · 1.41 KB
/
trello
File metadata and controls
executable file
·47 lines (42 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
if (( "$#" < 2 || "$#" > 3 ))
then
echo "Usage is: $0 <shorthand> \"<title>\" [\"<desc>\"]";
echo "For example: trello misc 'Do this and that' \"do it tomorrow please\"";
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 "| notes | NotesA | Reference";
echo "| action | Actionable | Daily";
# echo "| notes | NotesA | Reference";
exit 1
fi
case "$1" in
'in')
listid='57cddb24b4f255652ea09165';;
'tabs')
listid='57cb664b720ab94e69f2cba0';;
'misc')
listid='57cf7bedc647e55bf530fd9f';;
'notes')
listid='57cb8f9fdeba4fcf64ce6fff';;
'action')
listid='57cc89a9b7089c9a2566a3a6';;
*)
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)
token=$(cat "$(dirname $(readlink -f $0))/trello.token")
data="name=$safe_name&due=null&idList=$listid&token=$token&key=dde1edb7e72a3c12ed94e0fd6bbcba05"
if (( "$#" == 3 )); then
data="$data&desc=$3";
fi
# 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