i3 - improved tiling WM


Testcases: new-test prints usage without input

Patch status: merged

Patch by Tony Crisci

Long description:

Prevent the accidental creation of new tests with empty names by
printing usage information for new-test when the test name would be
empty.

To apply this patch, use:
curl http://cr.i3wm.org/patch/271/raw.patch | git am

b/testcases/new-test

16
@@ -15,6 +15,16 @@ use File::Basename qw(basename);
17
 use Getopt::Long;
18
 use v5.10;
19
 
20
+my $usage = <<'EOF';
21
+Script to create a new testcase from a template.
22
+
23
+    # Create (and edit) a new test for moving floating windows
24
+    ./new-test floating move
25
+
26
+    # Create (and edit) a multi-monitor test for moving workspaces
27
+    ./new-test -m move workspaces
28
+EOF
29
+
30
 my $multi_monitor;
31
 
32
 my $result = GetOptions(
33
@@ -24,6 +34,11 @@ my $result = GetOptions(
34
 my $testname = join(' ', @ARGV);
35
 $testname =~ s/ /-/g;
36
 
37
+unless (length $testname) {
38
+    say $usage;
39
+    exit(0);
40
+}
41
+
42
 my $header = <<'EOF';
43
 #!perl
44
 # vim:ts=4:sw=4:expandtab