all repos — conver-tool @ ddbb2902791eb80cfeddae59a5624a5a3e8d16c4

A command line tool to manage ConVer projects.

Implemented history command.
h3rald h3rald@h3rald.com
Fri, 12 Jun 2026 11:33:05 +0200
commit

ddbb2902791eb80cfeddae59a5624a5a3e8d16c4

parent

8e417b3f0c3691b7ca057dd2cfae4dccf18f41f6

1 files changed, 34 insertions(+), 7 deletions(-)

jump to
M src/conver.csrc/conver.c

@@ -200,6 +200,11 @@ uint16_t meta = metadata(version);

return (meta % 2) ? CONVER_PURPOSE_ENHANCE : CONVER_PURPOSE_MAINT; } +uint16_t version(conver_release_t r) +{ + return (r.score << 4) + r.metadata; +} + char *date(const struct tm d, char *dest, size_t dest_size) {

@@ -273,17 +278,18 @@ }

return 0; } -void print_release(conver_release_t *r) +void print_version(uint16_t version) { - char date_str[11]; - printf("-- %s: v%03X-%1X\n", date(r->date, date_str, sizeof(date_str)), r->score, r->metadata); - printf(" %s\n", r->comment); + printf(" v%03X-%1X (Stage: %s)\n", score(version), metadata(version), conver_stages[stage(version)]); + printf(" Impact: %s - Compatibility: %s - Purpose: %s\n", conver_impacts[impact(version)], conver_compatibilities[compatibility(version)], conver_purposes[purpose(version)]); } -void print_version(uint16_t version) +void print_release(conver_release_t r) { - printf(" v%03X-%1X (Stage: %s)\n", score(version), metadata(version), conver_stages[stage(version)]); - printf(" Impact: %s - Compatibility: %s - Purpose: %s\n", conver_impacts[impact(version)], conver_compatibilities[compatibility(version)], conver_purposes[purpose(version)]); + char date_str[11]; + printf("-- %s\n", date(r.date, date_str, sizeof(date_str))); + print_version(version(r)); + printf(" %s\n\n", r.comment); } int parse_history() {

@@ -628,6 +634,23 @@ print_version(draft);

} return CONVER_OK; } + +int command_history() +{ + int result = parse_history(); + if (result != CONVER_OK){ + return result; + } + if (history_size == 0) { + printf("No project history available.\n"); + return CONVER_OK; + } + for (int i=0; i<history_size; i++) + { + print_release(history[i]); + } + return CONVER_OK; +} //// Main

@@ -664,6 +687,10 @@ }

if ((strcmp(arg, "status") == 0)) { return command_status(); + } + if ((strcmp(arg, "history") == 0)) + { + return command_history(); } } }