sub usage_desc { '%c [-cp] add id' }
my %TABLE = (
- contest => \&add_contest,
- problem => \&add_problem,
+ contests => \&add_contest,
+ problems => \&add_problem,
);
sub validate_args {
my ($self, $opt, $args) = @_;
my @args = @$args;
$self->usage_error('No table selected') unless $self->app->table;
- $self->usage_error('Don\'t know how to add this object type') unless $TABLE{$self->app->object};
+ $self->usage_error('Don\'t know how to add to this table') unless $TABLE{$self->app->table};
$self->usage_error('Wrong number of arguments') if @args != 1;
}
sub execute {
my ($self, $opt, $args) = @_;
my ($id) = @$args;
- $TABLE{$self->app->object}->($self, $id);
+ $TABLE{$self->app->table}->($self, $id);
}
sub add_contest {