Improve defining aliases with = or ' '
FossilOrigin-Name: 4f4679531775a27e628d632735bd14150df79ae48654646499313d1caf75cefb
This commit is contained in:
parent
e794afe09a
commit
2529c59c44
1 changed files with 4 additions and 3 deletions
7
shelldap
7
shelldap
|
|
@ -1596,18 +1596,19 @@ sub run_alias
|
||||||
unless( $cmd_args) {
|
unless( $cmd_args) {
|
||||||
print "alias: $alias: not found\n";
|
print "alias: $alias: not found\n";
|
||||||
} else {
|
} else {
|
||||||
print "alias $alias=${\( join ', ', map {\"'$_'\"} @{$cmd_args})}\n";
|
print "alias $alias=${\( join ' ', map { $_=~ /\s/ ? \"'$_'\" : $_} @{$cmd_args})}\n";
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
||||||
# There is argument with =, so the line is a new alias definition
|
# There is argument with =, so the line is a new alias definition
|
||||||
} else {
|
} else {
|
||||||
my($alias, $command) = ($cmd_alias =~ m/^(\S+?)[=\s]?(.*)$/);
|
my($alias, $alias2, $command) = ($cmd_alias =~ m/^([a-zA-Z0-9_-]+)$|^(\S+?)[\=\s]+(.+)$/);
|
||||||
|
$alias = $alias2 if $alias2;
|
||||||
unless( $alias) {
|
unless( $alias) {
|
||||||
print "Invalid syntax.\n";
|
print "Invalid syntax.\n";
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
$command = $cmd_map{$command}[0] if $cmd_map{$command} and $cmd_map{$command}[0];
|
$command = $cmd_map{$command}[0] if $command and $cmd_map{$command} and $cmd_map{$command}[0];
|
||||||
$conf->{alias}{$alias} = [ $command ? $command : (), @_ ];
|
$conf->{alias}{$alias} = [ $command ? $command : (), @_ ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue