Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

option to list mad-pages

  • Loading branch information...
commit 70a1bef301cb3384c74deb69b23c1e8e198579d3 1 parent d89394f
@thomd thomd authored
Showing with 23 additions and 2 deletions.
  1. +2 −1  Readme.md
  2. +19 −0 bin/mad
  3. +2 −1  share/mad/mad.md
View
3  Readme.md
@@ -14,8 +14,9 @@
Options:
-u, --update update remote mad-pages
- -V, --version output cpm version
+ -v, --version output mad version
-h, --help output this help information
+ -l, --list list mad-pages
## Installation
View
19 bin/mad
@@ -4,6 +4,22 @@ VERSION="0.2.0"
REMOTE=git@github.com:visionmedia/mad-pages.git
#
+# List all <pages>
+#
+
+list_pages() {
+ IFS=":"
+ local paths="$MAD_PATH:/usr/local/share/mad:/usr/share/mad"
+
+ echo
+ echo -e " \033[1mmad pages\033[0m"
+ echo
+ for path in $paths; do
+ test ! -z $path && test -d $path && find $path -type f -print0 | xargs -0 basename | grep -iv 'readme*' | grep '.md$' | perl -pe 's|^(.*)\.md$| \1|;'
+ done
+}
+
+#
# Display <page> with lookup via MAD_PATH.
#
@@ -90,6 +106,9 @@ case $1 in
-u|--update)
install_all_remote
;;
+ -l|--list)
+ list_pages
+ ;;
*)
display $1
;;
View
3  share/mad/mad.md
@@ -12,8 +12,9 @@
Options:
-u, --update update remote mad-pages
- -V, --version output mad version
+ -v, --version output mad version
-h, --help output this help information
+ -l, --list list mad-pages
## Installation

0 comments on commit 70a1bef

Please sign in to comment.
Something went wrong with that request. Please try again.