version.c (579B)
1 #include <stddef.h> 2 #include <stdio.h> 3 4 #include "registry.h" 5 #include "sfinx.h" 6 7 static int cmd_version(int argc, const char **argv) { 8 (void)argc; 9 (void)argv; 10 fprintf(stdout, "%s\n", sfinx_version()); 11 return 0; 12 } 13 14 static struct cli_command version_command = { 15 .names = (const char *const[]){"version", NULL}, 16 .display = "version", 17 .description = "Show the version", 18 .help = "sfinx version", 19 .fn = cmd_version, 20 }; 21 22 __attribute__((constructor)) static void version_register(void) { 23 cli_command_register(&version_command); 24 }