chiark / gitweb /
cmd_version: check error
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 98fd04d17e1fa1940e38fa0f3cd720ea790e4484..37e83641324dbcdb30d9ecc4b0f4c7b7c0fb9964 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -28,6 +28,8 @@ use File::Basename;
 use Dpkg::Version;
 use POSIX;
 
+our $our_version = 'UNRELEASED'; ###substituted###
+
 our $isuite = 'unstable';
 our $idistro;
 our $package;
@@ -230,7 +232,7 @@ sub badusage {
     exit 8;
 }
 
-sub helponly () {
+sub cmd_help () {
     print $helpmsg or die $!;
     exit 0;
 }
@@ -1199,6 +1201,10 @@ sub cmd_quilt_fixup {
     build_maybe_quilt_fixup();
 }
 
+sub cmd_version {
+    print "dgit version $our_version\n" or die $!;
+}
+
 sub parseopts () {
     my $om;
     while (@ARGV) {
@@ -1211,7 +1217,7 @@ sub parseopts () {
            } elsif (m/^--no-sign$/) {
                $sign=0;
            } elsif (m/^--help$/) {
-               helponly();
+               cmd_help();
            } elsif (m/^--new$/) {
                $new_package=1;
            } elsif (m/^--(\w+)=(.*)/s &&
@@ -1241,7 +1247,7 @@ sub parseopts () {
                if (s/^-n/-/) {
                    $dryrun=1;
                } elsif (s/^-h/-/) {
-                   helponly();
+                   cmd_help();
                } elsif (s/^-D/-/) {
                    open DEBUG, ">&STDERR" or die $!;
                    $debug++;