diff --git a/doc/man_kjournalprint.rst b/doc/man_kjournalprint.rst index 85dcd3b3c9bfeb6e6358c3f524bdf2a6dea3080b..6748c31d9bf1386f5f2b9c8ff38121e23263e816 100644 --- a/doc/man_kjournalprint.rst +++ b/doc/man_kjournalprint.rst @@ -6,24 +6,26 @@ kjournalprint – Knot DNS journal print utility Synopsis -------- -:program:`kjournalprint` [*parameters*] *journal* *zone_name* +:program:`kjournalprint` [*options*] *journal_db* *zone_name* Description ----------- -Program requires journal. As default, changes are colored for terminal. +The program prints zone history stored in a journal database. As default, +changes are colored for terminal. -Parameters -.......... - -**-n**, **--no-color** - Removes changes coloring. +Options +....... **-l**, **--limit** *limit* Limits the number of displayed changes. -**-t**, **--list-zones** - Instead of reading jurnal, display the list of zones in the DB (*zone_name* not needed) +**-n**, **--no-color** + Removes changes coloring. + +**-z**, **--zone-list** + Instead of reading jurnal, display the list of zones in the DB. + (*zone_name* not needed) **-h**, **--help** Print the program help. @@ -31,25 +33,21 @@ Parameters **-V**, **--version** Print the program version. -Journal -....... - -Requires journal in the form of path/zone-name.db +Parameters +.......... -Zone name -......... +*journal_db* + A path to the journal database. -Requires name of the zone contained in the journal. +*zone_name* + A name of the zone to print the history for. Examples -------- -Last (*most recent*) 5 changes without colors -............................................. - -:: +Last (most recent) 5 changes without colors:: - $ kjournalprint -nl 5 example.com.db example.com. + $ kjournalprint -nl 5 /var/lib/knot/journal example.com. See Also -------- diff --git a/src/utils/kjournalprint/main.c b/src/utils/kjournalprint/main.c index f78350d003ee3254338de3ea60fdd08e69ddd878..592d41390f68544e5934eaba9a72c326ab580756 100644 --- a/src/utils/kjournalprint/main.c +++ b/src/utils/kjournalprint/main.c @@ -32,13 +32,13 @@ static void print_help(void) { - printf("Usage: %s [parameter] <journal> <zone_name>\n" + printf("Usage: %s [parameter] <journal_db> <zone_name>\n" "\n" "Parameters:\n" - " -n, --no-color Get output without terminal coloring.\n" - " -l, --limit <Limit> Read only x newest changes.\n" - " -t, --list-zones Instead of reading jurnal, display the list\n" - " of zones in the DB (<zone_name> not needed)\n", + " -l, --limit <num> Read only <num> newest changes.\n" + " -n, --no-color Get output without terminal coloring.\n" + " -z, --zone-list Instead of reading jurnal, display the list\n" + " of zones in the DB (<zone_name> not needed).\n", PROGRAM_NAME); } @@ -167,20 +167,17 @@ int main(int argc, char *argv[]) bool color = true, justlist = false; struct option opts[] = { - { "list-zones", no_argument, NULL, 't' }, - { "limit", required_argument, NULL, 'l' }, - { "no-color", no_argument, NULL, 'n' }, - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, + { "limit", required_argument, NULL, 'l' }, + { "no-color", no_argument, NULL, 'n' }, + { "zone-list", no_argument, NULL, 'z' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, { NULL } }; int opt = 0; - while ((opt = getopt_long(argc, argv, "tl:nhV", opts, NULL)) != -1) { + while ((opt = getopt_long(argc, argv, "l:nzhV", opts, NULL)) != -1) { switch (opt) { - case 't': - justlist = true; - break; case 'l': if (str_to_u32(optarg, &limit) != KNOT_EOK) { print_help(); @@ -190,6 +187,9 @@ int main(int argc, char *argv[]) case 'n': color = false; break; + case 'z': + justlist = true; + break; case 'h': print_help(); return EXIT_SUCCESS;