aboutsummaryrefslogtreecommitdiff
path: root/status
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-07-27 10:54:12 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-07-27 10:54:12 -0300
commit8b3d6363b901ebac30d858911191f4fc848e39d3 (patch)
tree38c251f1a8100c2e138277697c936c5dff1b2e69 /status
parentf6efc3d90a2d4f356f58dd500eb9e5d0f15c36aa (diff)
downloadscripts-8b3d6363b901ebac30d858911191f4fc848e39d3.tar.gz
scripts-8b3d6363b901ebac30d858911191f4fc848e39d3.tar.bz2
Status: support for --loop option
Diffstat (limited to 'status')
-rwxr-xr-xstatus70
1 files changed, 45 insertions, 25 deletions
diff --git a/status b/status
index 397abce..a9a05a7 100755
--- a/status
+++ b/status
@@ -5,36 +5,56 @@
# Parameters
PROJECT="$1"
+DELAY="$2"
-# Dispatch
-if [ ! -z "$PROJECT" ]; then
- # Check the status of the given project
- cd $PROJECT &> /dev/null && git status
-elif git status &> /dev/null; then
- # Check the status of the current project
- mr status
-else
- # Ensure we are in the home folder
- cd
+# Run status
+function status_run {
+ if [ ! -z "$PROJECT" ]; then
+ # Check the status of the given project
+ cd $PROJECT &> /dev/null && git status
+ elif git status &> /dev/null; then
+ # Check the status of the current project
+ mr status
+ else
+ # Ensure we are in the home folder
+ cd
- # Check your reminders
- if [ -e "$HOME/.reminders" ]; then
- remind ~/.reminders | grep -v '^No reminders.$'
- fi
+ # Check your reminders
+ if [ -e "$HOME/.reminders" ]; then
+ remind ~/.reminders | grep -v '^No reminders.$'
+ fi
- # Update your mrconfig and check all registered repositories
- mrconfig-updater && mr -m status
+ # Update your mrconfig and check all registered repositories
+ mrconfig-updater && mr -m status
- # Check your TODO lists
- todo
+ # Check your TODO lists
+ todo
- # Check if you have mails to send
- postponed
+ # Check if you have mails to send
+ postponed
- # Check if are dangling downloaded files
- if [ -e "$HOME/load" ] && [ ! -z "`ls -1 ~/load/`" ]; then
- echo "Dangling files at ~/load:"
- echo ""
- ls -lh ~/load/
+ # Check if are dangling downloaded files
+ if [ -e "$HOME/load" ] && [ ! -z "`ls -1 ~/load/`" ]; then
+ echo "Dangling files at ~/load:"
+ echo ""
+ ls -lh ~/load/
+ fi
fi
+}
+
+# Dispatch
+if [ "$PROJECT" == "--loop" ]; then
+ PROJECT=""
+
+ if [ -z "$DELAY" ]; then
+ DELAY="30"
+ fi
+
+ while true; do
+ status_run
+ sleep $DELAY
+ clear
+ done
+else
+ status_run
fi