Skip to content

Commit 02b36d4

Browse files
committed
improve maintain command
1 parent 9e44863 commit 02b36d4

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ To install or update LODA, please follow the [installation instructions](https:/
22

33
## [Unreleased]
44

5+
### Enhancements
6+
7+
* Improve internal maintenance command
8+
59
## v24.12.16
610

711
### Bugfixes

src/cmd/commands.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -634,21 +634,29 @@ void Commands::migrate() {
634634
manager.migrate();
635635
}
636636

637-
void Commands::maintain(const std::string& id) {
637+
void Commands::maintain(const std::string& ids) {
638638
initLog(false);
639639
OeisManager manager(settings);
640640
manager.load();
641641
size_t start = 0;
642642
size_t end = manager.getTotalCount() + 1;
643-
bool check = false;
644-
if (!id.empty()) {
645-
OeisSequence seq(id);
646-
start = seq.id;
647-
end = seq.id + 1;
648-
check = true;
643+
bool eval = false;
644+
if (!ids.empty()) {
645+
auto pos = ids.find('-');
646+
if (pos != std::string::npos) {
647+
OeisSequence seq_start(ids.substr(0, pos));
648+
OeisSequence seq_end(ids.substr(pos + 1));
649+
start = seq_start.id;
650+
end = seq_end.id + 1;
651+
} else {
652+
OeisSequence seq(ids);
653+
start = seq.id;
654+
end = seq.id + 1;
655+
eval = true;
656+
}
649657
}
650658
for (size_t id = start; id < end; id++) {
651-
manager.maintainProgram(id, check);
659+
manager.maintainProgram(id, eval);
652660
}
653661
}
654662

0 commit comments

Comments
 (0)