diff --git a/source/dub/commandline.d b/source/dub/commandline.d index 1354855..108617a 100644 --- a/source/dub/commandline.d +++ b/source/dub/commandline.d @@ -55,6 +55,17 @@ } args = args[1 .. $]; // strip the application name + // handle direct dub options + if (args.length) switch (args[0]) + { + case "--version": + showVersion(); + return 0; + + default: + break; + } + // parse general options bool verbose, vverbose, quiet, vquiet; bool help, annotate; @@ -1457,7 +1468,7 @@ private void showHelp(in CommandGroup[] commands, CommandArgs common_args) { writeln( -`USAGE: dub [] [] [-- []] +`USAGE: dub [--version] [] [] [-- []] Manages the DUB project in the current directory. If the command is omitted, DUB will default to "run". When running an application, "--" can be used to @@ -1500,6 +1511,11 @@ writeln(); writeOptions(common_args); writeln(); + showVersion(); +} + +private void showVersion() +{ writefln("DUB version %s, built on %s", getDUBVersion(), __DATE__); } diff --git a/test/run-unittest.sh b/test/run-unittest.sh index 0581901..a308ef4 100755 --- a/test/run-unittest.sh +++ b/test/run-unittest.sh @@ -20,6 +20,12 @@ CURR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +for script in $(ls $CURR_DIR/*.sh); do + if [ "$script" = "$(readlink -f ${BASH_SOURCE[0]})" ]; then continue; fi + log "Running $script..." + $script || die "Script failure." +done + for pack in $(ls -d $CURR_DIR/*/); do # First we build the packages if [ ! -e $pack/.no_build ]; then # For sourceLibrary diff --git a/test/test-version-opt.sh b/test/test-version-opt.sh new file mode 100755 index 0000000..2931868 --- /dev/null +++ b/test/test-version-opt.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +$DUB --version | grep -qF 'DUB version'