Parcourir la source

Add a `-n` switch to number lines

Samuel W. Flint il y a 1 an
Parent
commit
d33a9c220a
1 fichiers modifiés avec 24 ajouts et 6 suppressions
  1. 24 6
      pod

+ 24 - 6
pod

@@ -88,18 +88,36 @@ case "$CMD" in
         exit
         ;;
     list)
-        if [ $# -lt 1 ] ; then
-            find_unlistened --in=here
+        if [ ${1:-""} == "-n" ] ; then
+            shift
+            if [ $# -lt 1 ] ; then
+                find_unlistened --in=here | nl
+            else
+                find_unlistened --in=here | grep $@ | nl
+            fi
         else
-            find_unlistened --in=here | grep $@
+            if [ $# -lt 1 ] ; then
+                find_unlistened --in=here
+            else
+                find_unlistened --in=here | grep $@
+            fi
         fi
         exit
         ;;
     list-all)
-        if [ $# -lt 1 ] ; then
-            find_unlistened
+        if [ ${1:-u} == "-n" ]  ; then
+            shift
+            if [ $# -lt 1 ] ; then
+                find_unlistened | nl
+            else
+                find_unlistened | grep $@ | nl
+            fi
         else
-            find_unlistened | grep $@
+            if [ $# -lt 1 ] ; then
+                find_unlistened
+            else
+                find_unlistened | grep $@
+            fi
         fi
         exit
         ;;