Update a few things in handy_funcs.
authorSteve Youngs <steve@steveyoungs.com>
Wed, 20 Jan 2021 03:54:32 +0000 (13:54 +1000)
committerSteve Youngs <steve@steveyoungs.com>
Wed, 20 Jan 2021 03:54:32 +0000 (13:54 +1000)
* etc/pkgusr/handy_funcs: Default the editing aliases to use vi
instead of nano.
(chkg,makeg): Check, and make counterparts to instg().
(showinst): Rename to ipkg. Remove the alias.
(showgen): Rename to gpkg. Remove the alias.
(prep_git): Convenience function to set up nicer git config.
(H-pkg): Update to reflect these changes.

Signed-off-by: Steve Youngs <steve@steveyoungs.com>
etc/pkgusr/bash_profile
etc/pkgusr/handy_funcs

index bc756dd..f1997e8 100644 (file)
@@ -73,6 +73,11 @@ fi
 # Go to the home directory whenever we su to a package user.
 cd
 
+# Setup the git config if needed
+if [[ ! -d ${HOME}/.config/git && -f ${HOME}/.gitconfig ]]; then
+    prep_git
+fi
+
 # Maybe check if the build script can be updated, but not on dumb
 # terms so that TRAMP still works.
 if [ ${CHECKUPDATES} -eq 1 -a "$TERM" != "dumb" ]; then
index d7d447f..1a7cf08 100644 (file)
@@ -1,5 +1,5 @@
 # -*- shell-script -*-
-# Copyright (C) 2007 - 2014 Steve Youngs <steve@sxemacs.org>
+# Copyright (C) 2007 - 2021 Steve Youngs <steve@sxemacs.org>
 
 # What lies here is a collection of handy bash shell functions and
 # aliases that make life a little easier for pkgusr.
@@ -64,6 +64,24 @@ instg()
     grep --colour=always '^\*\*\*' ${HOME}/install.${arg}|less
 }
 
+chkg()
+{
+    local arg=$1
+    if [ -z "$arg" ]; then
+       arg=err
+    fi
+    grep --colour=always '^\*\*\*' ${HOME}/check.${arg}|less
+}
+
+makeg()
+{
+    local arg=$1
+    if [ -z "$arg" ]; then
+       arg=err
+    fi
+    grep --colour=always '^\*\*\*' ${HOME}/make.${arg}|less
+}
+
 dlog()
 {
     for log in configure make check install upd verupd; do
@@ -80,14 +98,14 @@ updver()
     grep --colour Version:.*$ ${HOME}/.project
 }
 
-showinst()
+ipkg()
 {
     local top=$(grep -n "^Install Notes:$" ${HOME}/.project|cut -d: -f1)
     local bot=$(grep -n "^General Notes:$" ${HOME}/.project|cut -d: -f1)
     sed -n ${top},${bot}p ${HOME}/.project|less
 }
 
-showgen()
+gpkg()
 {
     local top=$(grep -n "^General Notes:$" ${HOME}/.project|cut -d: -f1)
     local bot=$(grep -n "^CONTENTS:$" ${HOME}/.project|cut -d: -f1)
@@ -198,6 +216,16 @@ checkupdates()
     fi
 }
 
+## Convenience to allow existing pkgusrs to update their git
+#  config
+prep_git()
+{
+    install -vdm755 ${HOME}/.config/git &&
+    ln -svf /etc/pkgusr/gitconfig ${HOME}/.config/git/config &&
+    # Nuke the old ~/.gitconfig
+    rm -v ${HOME}/.gitconfig 2>/dev/null || true
+}
+
 ## Aliases
 # Repos/Websites
 alias srepo='grep --colour Repo_Location:.*$ ${HOME}/.project'
@@ -210,12 +238,14 @@ alias alogs='ls -l ${HOME}/*.{err,log}'
 alias lerr='ls -l ${HOME}/*.err'
 alias llog='ls -l ${HOME}/*.log'
 # Util
-alias ebld='nano -w ${HOME}/build'
-alias epro='nano -w ${HOME}/.project'
-alias ebp='nano -w ${HOME}/{build,.project}'
+## As of 2021-01-18 nano (v5.5) seems FUBAR'd
+alias ebld='vi ${HOME}/build'
+alias epro='vi ${HOME}/.project'
+alias ebp='vi -a ${HOME}/{build,.project}'
+# alias ebld='nano -w ${HOME}/build'
+# alias epro='nano -w ${HOME}/.project'
+# alias ebp='nano -w ${HOME}/{build,.project}'
 alias deps='grep --colour "Deps: " ${HOME}/.project'
-alias ipkg=showinst
-alias gpkg=showgen
 alias listp='pinky -l $(whoami)|less'
 
 H-pkg()
@@ -241,11 +271,15 @@ Logs:
         dlog            Removes all build logs
         instg {err|log} Greps install.err (default) or install.log for
                         pkgusr notifications ("*** some message")
+        chkg {err|log}  Greps check.err (default) or check.log for
+                        pkgusr notifications ("*** some message")
+        makeg {err|log} Greps make.err (default) or make.log for
+                        pkgusr notifications ("*** some message")
 
 Package Notes/Content:
 
-        showinst        Displays the \`Install Notes'. (alias: ipkg)
-        showgen         Displays the \`General Notes'. (alias: gpkg)
+        ipkg            Displays the \`Install Notes'. (alias: ipkg)
+        gpkg            Displays the \`General Notes'. (alias: gpkg)
         listp           Displays the entire package info (piped through less(1))
         srepo           Display the package's source repo location.
        rawrepo         Output just the repo URL (to use with lynx, curl, etc)
@@ -269,6 +303,12 @@ Build Scripts:
         updver [NEWVER] Updates the version in the .project.  It MUST be
                         quoted to protect it from shell expansion.
 
+Miscellaneous Bobs & Bits:
+
+        prep_git        Sets up ~/.config/git/config
+                        In the normal course of events you shouldn't need to
+                        use this as it happens during login if it is needed.
+
 
 EOF
 }