chiark / gitweb /
Usage message. Closes #720085.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 20 Aug 2013 18:42:40 +0000 (19:42 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 20 Aug 2013 18:42:40 +0000 (19:42 +0100)
debian/changelog
dgit
dgit.1

index f40ba5ab50c8911dacae6a004816022fe54c2208..1e6ac2477146ca45b2b90612c3acef3cede851bf 100644 (file)
@@ -1,6 +1,7 @@
 dgit (0.4) experimental; urgency=low
 
   * Use dgit.debian.net vhost on alioth.  Closes #720172.
 dgit (0.4) experimental; urgency=low
 
   * Use dgit.debian.net vhost on alioth.  Closes #720172.
+  * Usage message.  Closes #720085.
   * Assorted manpage fixes.
 
  --
   * Assorted manpage fixes.
 
  --
diff --git a/dgit b/dgit
index 4ba102a8f75a8e5f5505c4b0992800e352cf409c..396cc4d8c0cb547cdfd95179cfd38ec252949727 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -146,6 +146,25 @@ sub runcmd_ordryrun {
     }
 }
 
     }
 }
 
+our $helpmsg = <<END;
+main usages:
+  dgit [dgit-opts] clone [dgit-opts] package [suite] [./dir|/dir]
+  dgit [dgit-opts] fetch|pull [dgit-opts] [suite]
+  dgit [dgit-opts] build [git-buildpackage-opts|dpkg-buildpackage-opts]
+  dgit [dgit-opts] push [dgit-opts] [suite]
+important dgit options:
+  -k<keyid>           sign tag and package with <keyid> instead of default
+  --dry-run -n        do not change anything, but go through the motions
+  --new -N            allow introducing a new package
+  --debug -D          increase debug level
+  -c<name>=<value>    set git config option (used directly by dgit too)
+END
+
+sub helponly () {
+    print $helpmsg or die $!;
+    exit 0;
+}
+
 our %defcfg = ('dgit.default.distro' => 'debian',
               'dgit.default.username' => '',
               'dgit.default.archive-query-default-component' => 'main',
 our %defcfg = ('dgit.default.distro' => 'debian',
               'dgit.default.username' => '',
               'dgit.default.archive-query-default-component' => 'main',
@@ -812,6 +831,8 @@ sub parseopts () {
                $dryrun=1;
            } elsif (m/^--no-sign$/) {
                $sign=0;
                $dryrun=1;
            } elsif (m/^--no-sign$/) {
                $sign=0;
+           } elsif (m/^--help$/) {
+               helponly();
            } elsif (m/^--new$/) {
                $new_package=1;
            } elsif (m/^--(\w+)=(.*)/s && ($om = $opts_opt_map{$1})) {
            } elsif (m/^--new$/) {
                $new_package=1;
            } elsif (m/^--(\w+)=(.*)/s && ($om = $opts_opt_map{$1})) {
@@ -827,6 +848,8 @@ sub parseopts () {
            while (m/^-./s) {
                if (s/^-n/-/) {
                    $dryrun=1;
            while (m/^-./s) {
                if (s/^-n/-/) {
                    $dryrun=1;
+               } elsif (s/^-h/-/) {
+                   helponly();
                } elsif (s/^-D/-/) {
                    open DEBUG, ">&STDERR" or die $!;
                    $debug++;
                } elsif (s/^-D/-/) {
                    open DEBUG, ">&STDERR" or die $!;
                    $debug++;
@@ -848,7 +871,10 @@ sub parseopts () {
 
 parseopts();
 print STDERR "DRY RUN ONLY\n" if $dryrun;
 
 parseopts();
 print STDERR "DRY RUN ONLY\n" if $dryrun;
-die unless @ARGV;
+if (!@ARGV) {
+    print STDERR $helpmsg or die $!;
+    exit 8;
+}
 my $cmd = shift @ARGV;
 $cmd =~ y/-/_/;
 { no strict qw(refs); &{"cmd_$cmd"}(); }
 my $cmd = shift @ARGV;
 $cmd =~ y/-/_/;
 { no strict qw(refs); &{"cmd_$cmd"}(); }
diff --git a/dgit.1 b/dgit.1
index a62121cea72dc3d874a0287dcb28fe2c0e66f629..31cfa5a86e1d9d5c862cac40a72faaf83f0cfb5f 100644 (file)
--- a/dgit.1
+++ b/dgit.1
@@ -246,6 +246,9 @@ package we are trying to push.  But with --new that will not work, so
 we guess
 .B dpkg
 or use the value of this option.
 we guess
 .B dpkg
 or use the value of this option.
+.TP
+.BR -h | --help
+Print a usage summary.
 .SH SEE ALSO
 \fBdget\fP(1),
 \fBdput\fP(1),
 .SH SEE ALSO
 \fBdget\fP(1),
 \fBdput\fP(1),