Skip to content

Commit

Permalink
feat: add offset options
Browse files Browse the repository at this point in the history
  • Loading branch information
Adamska1008 committed Sep 12, 2024
1 parent c89c3d9 commit 60873b6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ add_subdirectory(libgit2pp)

# pthread is required for date-tz
target_link_libraries(today fmt::fmt libgit2pp tabulate date::date date::date-tz spdlog::spdlog cxxopts::cxxopts pthread)

target_compile_definitions(today PRIVATE
$<$<CONFIG:Debug>:DEBUG>
)
6 changes: 0 additions & 6 deletions src/libgit2pp/git_object.cpp

This file was deleted.

4 changes: 0 additions & 4 deletions src/libgit2pp/include/git_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@

namespace libgit2pp
{
extern long long REF_COUNT;

class git_object
{
public:
git_object()
{
git_libgit2_init();
spdlog::debug("Add REFCOUNT {}", ++REF_COUNT);
}
virtual ~git_object()
{
git_libgit2_shutdown();
spdlog::debug("Reduce REFCOUNT {}", --REF_COUNT);
}
};
}
5 changes: 4 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ int main(int argc, char **argv)
#endif
cxxopts::Options options("today", "Use today to review what you've accomplished today!");
options.add_options()
("o,offset", "Offset from today", cxxopts::value<int>()->default_value("0"))
("d,directory", "The working directory to be check", cxxopts::value<std::string>()->default_value("."))
("h,help", "Print usage");
auto result = options.parse(argc, argv);
Expand All @@ -66,7 +67,9 @@ int main(int argc, char **argv)
fmt::println("{}", options.help());
return 0;
}
auto offset = result["offset"].as<int>();
auto dir = result["directory"].as<std::string>();
auto cs = collect_info(dir, today());
spdlog::debug("{}", offset);
auto cs = collect_info(dir, today() - date::days(offset));
print_commits_info(cs);
}

0 comments on commit 60873b6

Please sign in to comment.