use Gruntmaster::App '-command';
use Gruntmaster::Data;
+use Gruntmaster::App::Command::Set;
+BEGIN { *PAGES = *Gruntmaster::App::Command::Set::PAGES }
+
sub usage_desc { '%c [-cjpu] edit id column' }
sub validate_args {
my $editor = $ENV{EDITOR} // 'editor';
system $editor, $file;
db->update($self->app->table, {$col => scalar read_file $file}, {id => $obj});
+ purge PAGES->{$self->app->table}.$_ for '', $obj;
}
1;
use File::Slurp qw/read_file/;
+use constant PAGES => {
+ contests => '/ct/',
+ jobs => '/log/',
+ problems => '/pb/',
+ users => '/us/',
+};
+
sub opt_spec {
['file!', 'Use the contents of a file as value']
}
my ($id, %values) = @$args;
%values = map { $_ => scalar read_file $values{$_} } keys %values if $opt->{file};
db->update($self->app->table, \%values, {id => $id});
+ purge PAGES->{$self->app->table}.$_ for '', $id;
}
1;