navid/veins / commit
884b6edddf52
Navid M <navidmomtahen@gmail.com> · 2026-11-28
parents: 1abe412101df
Browse files at this commit · Download source
--- a/xveins/src/cli/cli.cpp+++ b/xveins/src/cli/cli.cpp@@ -698,6 +698,7 @@ std::string rev; bool col_titles = true; bool end_flags = false;+ bool all = false; std::optional<std::size_t> limit; bool first = false; auto parse_count = [](std::string_view text, std::size_t& out) -> bool {@@ -727,6 +728,8 @@ rev = args[++i]; } else if (!end_flags && arg == "-no-col-titles") { col_titles = false;+ } else if (!end_flags && (arg == "-a" || arg == "-all")) {+ all = true; } else if (!end_flags && (arg == "-l" || arg == "-f")) { if (i + 1 >= args.size()) { error_prefix();@@ -767,7 +770,9 @@ rev = arg; } }- if (!limit) {+ if (all) {+ limit.reset();+ } else if (!limit) { std::size_t amount = 20; if (auto configured = user_config_value("log.default_amount")) { if (!parse_count(*configured, amount))@@ -2414,14 +2419,15 @@ } void show_log() {- std::cout << "usage: vn log [-rev <revset>] [-lN | -fN] [-no-col-titles]\n\n";+ std::cout << "usage: vn log [-a] [-rev <revset>] [-lN | -fN] [-no-col-titles]\n\n"; std::cout << "show commit history, newest first\n\n"; std::cout << "options:\n";+ std::cout << " -a, -all show the entire history\n"; std::cout << " -rev <revset> show only the given revision set\n"; std::cout << " -lN, -l <N> show the last N commits (newest N)\n"; std::cout << " -fN, -f <N> show the first N commits (oldest N)\n"; std::cout << " -no-col-titles omit column titles\n\n";- std::cout << "without -l or -f, the last log.default_amount commits are shown\n";+ std::cout << "without -a, -l or -f, the last log.default_amount commits are shown\n"; std::cout << "(global config, default 20)\n"; } --- a/xveins/tests/integration_tests.cpp+++ b/xveins/tests/integration_tests.cpp@@ -393,6 +393,7 @@ t.expect_contains(help_text, "commands:"); t.expect_contains(help_text, "attr"); t.expect_contains(f.vn({"help", "log"}).out, "vn log");+ t.expect_contains(f.vn({"help", "log"}).out, "-a, -all"); t.expect_contains(f.vn({"help", "go"}).out, "aliases: commit"); t.expect_contains(f.vn({"help", "attr"}).out, "vn attr rm"); }@@ -896,6 +897,10 @@ f.vn({"cfg", "-global", "log.default_amount", "3"}); t.expect_eq(f.log_rows().size(), 3u);+ t.expect_eq(split_lines(f.vn({"log", "-a", "-no-col-titles"}).out).size(), 23u);+ t.expect_eq(split_lines(f.vn({"log", "-all", "-no-col-titles"}).out).size(), 23u);+ t.expect_eq(split_lines(f.vn({"log", "-a", "-l5", "-no-col-titles"}).out).size(), 23u);+ t.expect_eq(split_lines(f.vn({"log", "-l5", "-a", "-no-col-titles"}).out).size(), 23u); f.vn({"cfg", "log.default_amount", "1"}); t.expect_eq(f.log_rows().size(), 3u); t.expect_eq(split_lines(f.vn({"log", "-l5", "-no-col-titles"}).out).size(), 5u);