|
@@ -8,7 +8,9 @@ sub usage; sub mkexec; sub guesstype; sub getcmd; sub launch_editor;
|
8
|
8
|
|
9
|
9
|
my $DEFAULT_TYPE = 'pl';
|
10
|
10
|
my $DEFAULT_MODE = 0755;
|
|
11
|
+my $DEFAULT_FORCE = 0;
|
11
|
12
|
|
|
13
|
+my $force = $ARGV[0] == '-f' ? shift : $DEFAULT_FORCE;
|
12
|
14
|
my $name = shift or usage;
|
13
|
15
|
my $type = ($ARGV[0] ? shift : guesstype $name);
|
14
|
16
|
|
|
@@ -35,7 +37,7 @@ $cmds->{editor}->{run} = "editor '%s'";
|
35
|
37
|
|
36
|
38
|
|
37
|
39
|
if (exists $bangs->{$type}) {
|
38
|
|
- -e $name || mkexec $name, mkbody($type);
|
|
40
|
+ -e $name and not $force || mkexec $name, mkbody($type);
|
39
|
41
|
chmod $DEFAULT_MODE, $name;
|
40
|
42
|
launch_editor $name;
|
41
|
43
|
} else {
|