]> git.madduck.net Git - etc/awesome.git/blobdiff - scripts/dfs

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

pulseaudio -> pulse; scallback merged into cmd (read wiki)
[etc/awesome.git] / scripts / dfs
index f04b05127597e0d8322b4d35ebafa01795c3c9a1..9e02a8773daced934461d7c0a307b1123ef81343 100755 (executable)
@@ -1,20 +1,21 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 #   Adapted from Eridan's "fs" (cleanup, enhancements and switch to bash/Linux)
 #   JM,  10/12/2004
 #
 #   Integrated into Lain in september 2013
 #
 #   Adapted from Eridan's "fs" (cleanup, enhancements and switch to bash/Linux)
 #   JM,  10/12/2004
 #
 #   Integrated into Lain in september 2013
-#   https://github.com/copycat-killer/lain
+#   https://github.com/lcpz/lain
 
 #   Requires gawk
 
 # -------------------------------------------------------------------------
 #   Decoding options
 # -------------------------------------------------------------------------
 
 #   Requires gawk
 
 # -------------------------------------------------------------------------
 #   Decoding options
 # -------------------------------------------------------------------------
-USAGE="Usage: $0 [-h(elp)] | [-n(arrow mode)] | [-w(eb output)]"
+USAGE="Usage: $0 [-h(elp)] | [-n(arrow mode)] | [-w(eb output) | --type=<fstype> | --exclude-type=<fstype>]"
 
 NARROW_MODE=0
 WEB_OUTPUT=0
 
 NARROW_MODE=0
 WEB_OUTPUT=0
+DF_OPTIONS=""
 
 while [ $# -gt 0 ]; do
 case "$1" in
 
 while [ $# -gt 0 ]; do
 case "$1" in
@@ -31,6 +32,12 @@ NARROW_MODE=1
 "-w" )
 WEB_OUTPUT=1
 ;;
 "-w" )
 WEB_OUTPUT=1
 ;;
+--type=*)
+DF_OPTIONS+=" $1"
+;;
+--exclude-type=*)
+DF_OPTIONS+=" $1"
+;;
 * )
 echo $USAGE
 exit
 * )
 echo $USAGE
 exit
@@ -58,6 +65,9 @@ AWK_COMMAND="/usr/bin/env gawk"
 ;;
 esac
 
 ;;
 esac
 
+# Add additional df options
+DF_COMMAND+=$DF_OPTIONS
+
 # -------------------------------------------------------------------------
 #   Grabbing "df" result
 # -------------------------------------------------------------------------
 # -------------------------------------------------------------------------
 #   Grabbing "df" result
 # -------------------------------------------------------------------------
@@ -212,9 +222,9 @@ echo "$SORTED_FILE_SYSTEMS_INFO" | $AWK_COMMAND -v DEBUG=$DEBUG -v PATTERN=$PATT
                                                         printf ("\n%s", narrow_margin);
                                                 else
                                                         printf ("%-*s", LEFT_COLUMN + 2, "");
                                                         printf ("\n%s", narrow_margin);
                                                 else
                                                         printf ("%-*s", LEFT_COLUMN + 2, "");
-                                        print "                                                     Used    Free     Total ";
+                                        print "                                                    Used     Free       Total ";
                                         if (! NARROW_MODE)
                                         if (! NARROW_MODE)
-                                                print "";
+                                                print " ";
                                 }
                         }
 
                                 }
                         }
 
@@ -352,7 +362,7 @@ $0 ~ PATTERN    {
 #           printf ("stars_number = %d\n", stars_number);
 
                        printf ("|");
 #           printf ("stars_number = %d\n", stars_number);
 
                        printf ("|");
-                       for (i = 1; i <= stars_number; i++)
+                       for (i = 1; i <= stars_number && i <= 49; i++)
                        {
                                printf ("%s", "*");
                        }
                        {
                                printf ("%s", "*");
                        }