mirror of
https://github.com/dani/patrix.git
synced 2024-06-01 21:41:41 +02:00
Add aliases for actions
--foo is now equivalent of --action=foo
This commit is contained in:
parent
b19a7edc9a
commit
ffac9f3632
|
@ -28,6 +28,15 @@ GetOptions(
|
|||
"files=s" => \$opt->{file},
|
||||
"debug" => \$opt->{debug},
|
||||
"action=s" => \$opt->{action},
|
||||
"send-msg" => \$opt->{'send-msg'},
|
||||
"send-notice" => \$opt->{'send-notice'},
|
||||
"send-file" => \$opt->{'send-file'},
|
||||
"create-room" => \$opt->{'create-room'},
|
||||
"modify-room" => \$opt->{'modify-room'},
|
||||
"delete-room-alias" => \$opt->{'delete-room-alias'},
|
||||
"get-access-token" => \$opt->{'get-access-token'},
|
||||
"get-room-list" => \$opt->{'get-room-list'},
|
||||
"get-room-id" => \$opt->{'get-room-id'},
|
||||
"conf=s" => \$opt->{conf},
|
||||
"invite=s@" => \$opt->{invite},
|
||||
"name=s" => \$opt->{name},
|
||||
|
@ -49,6 +58,15 @@ if ($opt->{conf} && -e $opt->{conf}){
|
|||
read_conf();
|
||||
}
|
||||
|
||||
# alias for --action=foo is --foo
|
||||
foreach my $action (qw(send-msg send-notice send-file create-room modify-room
|
||||
delete-room-alias get-access-token get-room-list get-room-id)){
|
||||
if ($opt->{$action}){
|
||||
$opt->{action} = $action;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
my $lwp = LWP::UserAgent->new;
|
||||
|
||||
my $stdin = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user