Skip to content
Newer
Older
100755 85 lines (68 sloc) 1.76 KB
59d9890 thanks @deepakjois from https://gist.github.com/1470500
Divya Manian authored Dec 12, 2011
1 #!/bin/bash
2
3 # Function Abstracting Prompts
4
5 promptValue() {
6 read -p "$1"": " val
7 echo $val
8 }
9
10 feature=
7383c04 updated shell script to generate slug even when given a <tag>. Also u…
Divya Manian authored Jan 18, 2012
11 featureslug=
59d9890 thanks @deepakjois from https://gist.github.com/1470500
Divya Manian authored Dec 13, 2011
12 status=
13 tags=
cebaede adding a few of these polyfills.
Divya Manian authored Dec 13, 2011
14 kind=
59d9890 thanks @deepakjois from https://gist.github.com/1470500
Divya Manian authored Dec 13, 2011
15
16 while [ -z "$feature" ]
17 do
18 feature=$(promptValue "Enter Feature Name")
19 done
20
1c242e6 @deepakjois Make feature name slug friendly by doing case conversion and hyphenation
deepakjois authored Dec 17, 2011
21 # Make feature name slug friendly
7383c04 updated shell script to generate slug even when given a <tag>. Also u…
Divya Manian authored Jan 19, 2012
22 featureslug=$(
1c242e6 @deepakjois Make feature name slug friendly by doing case conversion and hyphenation
deepakjois authored Dec 18, 2011
23 echo $feature |
24 # Use sed to replace spaces with hyphens
4793097 updating shell script to use better regex
Divya Manian authored Jan 21, 2012
25 sed -E -e "s/ +/-/" -e "s/[^A-Za-z0-9\-]//g" |
7383c04 updated shell script to generate slug even when given a <tag>. Also u…
Divya Manian authored Jan 19, 2012
26
4793097 updating shell script to use better regex
Divya Manian authored Jan 22, 2012
27 # BSD sed doesnt accept \L, so use tr instead for case conversion
1c242e6 @deepakjois Make feature name slug friendly by doing case conversion and hyphenation
deepakjois authored Dec 18, 2011
28 tr "[A-Z]" "[a-z]"
29 )
30
59d9890 thanks @deepakjois from https://gist.github.com/1470500
Divya Manian authored Dec 13, 2011
31 while [ -z "$status" ]
32 do
86b6973 @connor add commas to bash_file options to make them more clear
connor authored Dec 16, 2011
33 status=$(promptValue "Enter Status (use,avoid, or caution)")
59d9890 thanks @deepakjois from https://gist.github.com/1470500
Divya Manian authored Dec 13, 2011
34 case $status in
35 use|avoid|caution) : ;;
36 *) status= ;;
37 esac
38 done
39
40 while [ -z "$tags" ]
41 do
86a7d2b adding css features. updated search permalink animation.
Divya Manian authored Dec 24, 2011
42 tags=$(promptValue "Enter Tags (one or more of: gtie6,gtie7,gtie8,prefixes,polyfill, fallback, or none)")
59d9890 thanks @deepakjois from https://gist.github.com/1470500
Divya Manian authored Dec 13, 2011
43 if [ -n "$tags" ]
44 then
45 set $(echo $tags)
46 while [ $# -gt 0 ]
47 do
48 case "$1" in
7383c04 updated shell script to generate slug even when given a <tag>. Also u…
Divya Manian authored Jan 19, 2012
49 gtie6|gtie7|gtie8|gtie9|prefixes|polyfill|fallback|noie|nomobile|nooldmobile|none) shift ;;
59d9890 thanks @deepakjois from https://gist.github.com/1470500
Divya Manian authored Dec 13, 2011
50 *) echo "Unknown Tag: $1" 1>&2; tags= ; break ;;
51 esac
52 done
53 fi
54 done
55
cebaede adding a few of these polyfills.
Divya Manian authored Dec 14, 2011
56 while [ -z "$kind" ]
57 do
86a7d2b adding css features. updated search permalink animation.
Divya Manian authored Dec 24, 2011
58 kind=$(promptValue "Enter Type (css,html,js,api or svg)")
cebaede adding a few of these polyfills.
Divya Manian authored Dec 14, 2011
59 case $kind in
86a7d2b adding css features. updated search permalink animation.
Divya Manian authored Dec 24, 2011
60 css|html|js|api|svg) : ;;
cebaede adding a few of these polyfills.
Divya Manian authored Dec 14, 2011
61 *) kind= ;;
62 esac
63 done
64
65
59d9890 thanks @deepakjois from https://gist.github.com/1470500
Divya Manian authored Dec 13, 2011
66 # Creating markdown file in posts folder
67 POSTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/posts"
68
7383c04 updated shell script to generate slug even when given a <tag>. Also u…
Divya Manian authored Jan 19, 2012
69 [ -e "$POSTS_DIR/$featureslug.md" ] && echo "$featureslug.md already exists" && exit 1
59d9890 thanks @deepakjois from https://gist.github.com/1470500
Divya Manian authored Dec 13, 2011
70
7383c04 updated shell script to generate slug even when given a <tag>. Also u…
Divya Manian authored Jan 19, 2012
71 cat > $POSTS_DIR/$featureslug.md <<EOF
59d9890 thanks @deepakjois from https://gist.github.com/1470500
Divya Manian authored Dec 13, 2011
72 feature: $feature
73 status: $status
74 tags: $tags
cebaede adding a few of these polyfills.
Divya Manian authored Dec 14, 2011
75 kind: $kind
59d9890 thanks @deepakjois from https://gist.github.com/1470500
Divya Manian authored Dec 13, 2011
76 polyfillurls:
77
78
79 EOF
80
7383c04 updated shell script to generate slug even when given a <tag>. Also u…
Divya Manian authored Jan 19, 2012
81 echo "Created file $POSTS_DIR/$featureslug.md" 1>&2
59d9890 thanks @deepakjois from https://gist.github.com/1470500
Divya Manian authored Dec 13, 2011
82
83 # Open it in your editor for adding content
7383c04 updated shell script to generate slug even when given a <tag>. Also u…
Divya Manian authored Jan 19, 2012
84 [ -n "$EDITOR" ] && $EDITOR "$POSTS_DIR/$featureslug.md"
Something went wrong with that request. Please try again.