Просмотр исходного кода

Add a `-n` switch to number lines

Samuel W. Flint 1 год назад
Родитель
Сommit
d33a9c220a
1 измененных файлов с 24 добавлено и 6 удалено
  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
         ;;