blob: 6acb597397d9279efc8f700a9eabb8565994c4b5 (
plain) (
blame)
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
|
#!/bin/ksh
# Bookmark a web page by send the contents in text format by email to 'bookmark@matthewlemon.com'
# for future indexing and searching by notmuch, etc.
OUT_FILE=/tmp/out1.txt
OUT_FILE_P=/tmp/outpanddoc
EMAIL=bookmark@matthewlemon.com
USAGE="f:[format]t:[title]u:[url]"
while getopts "$USAGE" optchar
do
case $optchar in
f) OUTFORMAT=$OPTARG ;;
u) URL=$OPTARG ;;
t) TITLE=$OPTARG ;;
?) echo $USAGE; exit 2 ;;
esac
done
shift $(($OPTIND - 1)) # not sure we need this
if ! [[ $OUTFORMAT == "md" || $OUTFORMAT == "markdown" || $OUTFORMAT == "plain" ]]
then
echo "Format must be 'md', 'markdown' or 'plain'."; exit 1;
fi
# if [ ${#@} -gt 0 ]
# then
# echo "Non-option arguments: " "$@"
# exit 1
# fi
echo "$OUTFORMAT" "$URL" "$TITLE";
echo "$URL" > $OUT_FILE
pandoc -f html "$URL" -t "$OUTFORMAT" -o $OUT_FILE_P
# neomutt -s "$TITLE" -i "$(cat $OUT_FILE $OUT_FILE_P)" $EMAIL
cat $OUT_FILE $OUT_FILE_P | mail -v -s "$TITLE" $EMAIL
rm $OUT_FILE $OUT_FILE_P
|