Add aliases for actions

--foo is now equivalent of --action=foo
tags/patrix-0.1.4-1
Daniel Berteaud 7 years ago
parent b19a7edc9a
commit ffac9f3632
  1. 18
      scripts/patrix

@ -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…
Cancel
Save