changeset 567:b8b028459622

Print help when user forget to pass files for opening.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Sun, 12 Jan 2014 22:26:15 +0200
parents 20647f24cb3f
children dd77081b7588
files emacs/e emacs/ew
diffstat 2 files changed, 20 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/emacs/e	Sun Jan 12 22:17:59 2014 +0200
+++ b/emacs/e	Sun Jan 12 22:26:15 2014 +0200
@@ -1,16 +1,21 @@
 #!/bin/sh
 # Written by Oleksandr Gavenko <gavenkoa@gmail.com>, 2008.
 
+usage() {
+  echo "Shortcut for emacsclient. See e(1) man page."
+  echo "Usage:"
+  echo "  e  file..."
+}
+
 case "$1" in
   -h|-help|--help)
-    echo "Shortcut for emacsclientw for busy people."
-    echo "Usage:"
-    echo "  e  file..."
+    usage
     exit 0
     ;;
   "")
-    echo "What file do you want to open?"
-    exit 0
+    printf "What file do you want to open?\n\n"
+    usage
+    exit 1
     ;;
 esac
 
--- a/emacs/ew	Sun Jan 12 22:17:59 2014 +0200
+++ b/emacs/ew	Sun Jan 12 22:26:15 2014 +0200
@@ -1,18 +1,22 @@
 #!/bin/sh
 # Written by Oleksandr Gavenko <gavenkoa@gmail.com>, 2008.
 
-# Name `ew' because `edit and wait for C-x #'.
+usage() {
+  echo "Shortcut for emacsclient. See ew(1) man page."
+  echo "Usage:"
+  echo "  ew  file..."
+
+}
 
 case "$1" in
   -h|-help|--help)
-    echo "Emacsclient run script."
-    echo "Usage:"
-    echo "  ew  file..."
+    usage
     exit 0
     ;;
   "")
-    echo "What file do you want to open?"
-    exit 0
+    printf "What file do you want to open?\n\n"
+    usage
+    exit 1
     ;;
 esac
 
@@ -20,6 +24,5 @@
   # We probably under Windows like OS.
   exec emacsclientw -a emacs "$@"
 else
-  # We under UNIX like OS.
   exec emacsclient -a emacs "$@"
 fi