Browse Source

Do not launch editor by default

Alois Mahdal 10 years ago
parent
commit
93bf2c3b4e
1 changed files with 8 additions and 3 deletions
  1. 8
    3
      bin/mkexec

+ 8
- 3
bin/mkexec View File

9
 my $DEFAULT_TYPE = 'sh';
9
 my $DEFAULT_TYPE = 'sh';
10
 my $DEFAULT_MODE = 0755;
10
 my $DEFAULT_MODE = 0755;
11
 my $DEFAULT_FORCE = 0;
11
 my $DEFAULT_FORCE = 0;
12
+my $DEFAULT_EDIT = 0;
12
 
13
 
13
 
14
 
14
 ## .... ##   . . .  .   .    .     .      .       .        .         .
15
 ## .... ##   . . .  .   .    .     .      .       .        .         .
16
 ## '''' ##   ' ' '  '   '    '     '      '       '        '         '
17
 ## '''' ##   ' ' '  '   '    '     '      '       '        '         '
17
 
18
 
18
 my $force = $DEFAULT_FORCE;
19
 my $force = $DEFAULT_FORCE;
19
-my $name; my $type;
20
+my $name; my $type; my $edit;
20
 
21
 
21
 foreach (@ARGV) {
22
 foreach (@ARGV) {
22
     if (m/-f|--force/) {
23
     if (m/-f|--force/) {
23
         $force++;
24
         $force++;
25
+    } elsif (m/-e|--edit/) {
26
+        $edit++;
27
+    } elsif (m/-E|--no-edit/) {
28
+        $edit = 0;
24
     } elsif (defined $name) {
29
     } elsif (defined $name) {
25
         $type = $_;
30
         $type = $_;
26
     } else {
31
     } else {
63
     (not -e $name or $force)
68
     (not -e $name or $force)
64
         and mkexec $name, mkbody($type);
69
         and mkexec $name, mkbody($type);
65
     chmod $DEFAULT_MODE, $name;
70
     chmod $DEFAULT_MODE, $name;
66
-    launch_editor $name;
71
+    launch_editor $name if $edit;
67
 } else {
72
 } else {
68
     die "unknown type: $type\n";
73
     die "unknown type: $type\n";
69
 }
74
 }
74
 ## '''' ##   ..............................................................-'
79
 ## '''' ##   ..............................................................-'
75
 
80
 
76
 sub usage {
81
 sub usage {
77
-    print STDERR "usage: $0 [-f] filename [type]\n";
82
+    print STDERR "usage: $0 [-f|-E] filename [type]\n";
78
     exit 0;
83
     exit 0;
79
 }
84
 }
80
 
85