lvu info ModuleX

Chad R. Kittel v3rt1g0 at lunar-linux.org
Tue Mar 15 03:28:08 UTC 2005


I would like to propose adding something like the following to lvu.  It's basically just a little "quick view" of a module.  Gives some basic biographical stats, info about it's installedness, and the last few items of the modules activity.  I know i find myself typing 'lvu installed ModuleX' followed by 'lvu version ModuleX' often.  This would be a shortcut to that, plus provide other useful info.

If this is something you devs wouldn't mind me adding to theedge, are we okay with the name... 'info' is a little lame.

Thoughts?

-- Chad K.

@@ -61,6 +61,7 @@
                                dependencies
 held                       display held modules
 exiled                     display exiled modules
+info        module         display a little summary of the module
 
 search      "phrase"       searches all modules long descriptions for phrase.
 service     port|acronym   displays modules that provide that service
@@ -640,6 +641,61 @@
   fi
 }
 
+do_info() {
+       if run_details $1 ; then
+         echo "General Module Info"
+         echo "  Name:          $MODULE"
+	 echo "  Description:   $SHORT"
+	 echo "  Website:       $WEB_SITE"
+	 echo "  Lunar Version: $VERSION"
+	 echo "  Last Updated:  $UPDATED"
+       echo "  Section:       $SECTION"
+	 if module_held $1; then
+	   echo "  Restrictions:  held"
+	 fi
+	 if [ -e $MOONBASE/$SECTION/$MODULE/services ]; then
+	   LINES="`wc -l $MOONBASE/$SECTION/$MODULE/services | cut -d' ' -f1`"
+	   echo -n "  Provides Service"
+	   if [ 1 -lt $LINES ]; then
+	    echo "s:"
+	   echo "`cat $MOONBASE/$SECTION/$MODULE/services | sed "s:\t: :g" | sed 's:^:    :g'`"
+	   else
+	    echo -n ": "
+	     echo "`cat $MOONBASE/$SECTION/$MODULE/services`"
+	   fi
+	 fi
+	 
+	 echo ""
+	 echo "Installation Info"
+	 if module_installed $1 ; then
+	   echo -n "  Installed Version: $(installed_version $1)"
+	   if module_is_expired $1; then
+	     echo "  (updated module available!)"
+	   else
+	     echo ""
+	   fi
+	   echo "  Approx. Size:      $(main size $1)"
+	   echo -n "  Files Installed:   "
+	   echo "`echo "$(main install $1)" | wc -l`"
+	 else
+	   echo "  Module not installed."
+	 fi
+	 
+	 echo ""
+	 ACTIVITY="`view_file $ACTIVITY_LOG | grep "$1"`"
+	 
+	 if [ `echo "$ACTIVITY" | wc -l` -gt 10 ]; then
+	   ACTIVITY="`echo "$ACTIVITY" | tail -n10`"
+	   echo "Module Activity History (last 10)"
+	 else
+	   echo "Module Activity History"
+	 fi
+	 if [ -n "$ACTIVITY" ]; then
+	   echo "$ACTIVITY" | sed 's:^:  :g'
+	 else
+	   echo "  No past activity recorded for this module."
+	 fi
+       fi
+}
 
 show_urls() { (
   # function overrides:
@@ -1019,6 +1075,14 @@
      fi
      ;;
 
+   info)
+     if [ ! -z "$2" ] ; then
+       do_info $2
+     else
+       echo "Please specify a module."
+     fi
+   ;;
+
    *)
      help
      ;;
@@ -1055,5 +1119,3 @@
   main $@
 fi


More information about the Lunar-dev mailing list