quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [PATCH 34/39] backup-files: Clarify command line options


From: Jean Delvare
Subject: [Quilt-dev] [PATCH 34/39] backup-files: Clarify command line options
Date: Sat, 19 Mar 2011 10:53:04 +0100
User-agent: quilt/0.48-17.1

Misc cleanups:
* Add my copyright and simplify the reference to the initial version.
* Drop the program description, as it is redundant with the usage
  function.
* Clarify the usage message, to make it clear what each option is
  doing, and which ones are compatible with each other.
* Let the script complain if no action is given, as this has to be a
  user or developer error.

Signed-off-by: Jean Delvare <address@hidden>
Reviewed-by: Raphael Hertzog <address@hidden>
---
 quilt/scripts/backup-files.in |   38 +++++++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 15 deletions(-)

--- a/quilt/scripts/backup-files.in
+++ b/quilt/scripts/backup-files.in
@@ -2,11 +2,9 @@
 
 set -e
 
-# File: backup-files.sh
-
 # Copyright (C) 2006 Steve Langasek <address@hidden>
-# portions Copyright (C) 2003, 2004, 2005, 2006 Andreas Gruenbacher
-# <address@hidden>, SuSE Labs
+# Copyright (C) 2011 Jean Delvare <address@hidden>
+# Loosely based on C implementation by Andreas Gruenbacher <address@hidden>
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -22,26 +20,35 @@ set -e
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
 # MA 02110-1301, USA.
 
-
-# Create backup files of a list of files similar to GNU patch. A path
-# name prefix for the backup files must be specified with the -B option.
-
 usage () {
-       echo "Usage: $0 -B prefix [-s] [-k] [-t] [-L] [-b|-r|-c|-x] {-f 
{file|-}|-|file ...}
+       echo "Usage: $0 -B prefix {-b|-r|-c|-x|-L} [-s] [-k] [-t] [-L] {-f 
{file|-}|-|file ...}
 
        Create or restore backup copies of a list of files.
 
-       -b      Create backup
+       Mandatory parameters:
+       -B      Path name prefix for backup files
+
+       Action parameters:
+       -b      Create backup (preserve links)
        -r      Restore the backup
        -c      Create simple copy
        -x      Remove backup files and empty parent directories
-       -k      When doing a restore, keep the backup files
-       -B      Path name prefix for backup files
+       -L      Ensure that source files have a link count of 1
+
+       Common options:
        -s      Silent operation; only print error messages
-       -f      Read the filenames to process from file (- = standard input)
+
+       Restore options:
+       -k      Keep backup files
        -t      Touch original files after restore (update their mtimes)
+       -L      Ensure that source files have a link count of 1
 
-       -L      Ensure that when finished, the source file has a link count of 1
+       Backup options:
+       -L      Ensure that source files have a link count of 1
+
+       File list parameters:
+       -f      Read the filenames to process from file (- = standard input)
+       -       Read the filenames to process from backup
 "
 }
 
@@ -343,7 +350,8 @@ if [ -z "$OPT_WHAT" ]; then
        if [ -n "$OPT_NOLINKS" ]; then
                OPT_WHAT=noop_nolinks
        else
-               exit 0
+               echo "Please specify an action" >&2
+               exit 1
        fi
 fi
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]