mirror of
https://github.com/arzzen/git-quick-stats.git
synced 2026-09-11 08:06:18 -04:00
* The previous commands were Lower CamelCase style and had no equivalent short options. If you wanted to see the branch tree via non-interactive mode, you always needed to supply "branchTree" as the passing argument to the git-quick-stats script. This commit changes the argument style to be more akin to the POSIX and GNU styles of arguments commonly seen in many other applications. As of this commit, there is no compatibility with legacy commands, so those who have been using the old commands will unfortunately need to get familiar with the new ones. All documentation and tests have been updated accordingly to reflect the new changes. * The main interactive loop contained a non-variable constant that was only getting parsed correctly due to legacy fallback behavior. This commit fixes the main loop and cleans up the formatting a little bit. * Added -r to more areas where read reads in a variable to help prevent it from mangling backslashes. * Changed everything to use bash's built-in [[ notation and did some minor formatting changes to reduce the LOC. * Removed some unnecessary echo statements and did some other minor cleanup.
20 lines
4.2 KiB
Bash
Executable file
20 lines
4.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
. tests/assert.sh -v
|
|
|
|
src="./git-quick-stats"
|
|
#assert "$src fail" "Invalid argument\n\nNAME\n git-quick-stats - Simple and efficient way to access various stats in a git repo\n\nSYNOPSIS\n For non-interactive mode: git-quick-stats [OPTIONS]\n For interactive mode: git-quick-stats\n\nDESCRIPTION\n Any git repository contains tons of information about commits, contributors,\n and files. Extracting this information is not always trivial, mostly because\n of a gadzillion options to a gadzillion git commands.\n\n This program allows you to see detailed information about a git repository.\n\nOPTIONS\n suggestReviewers - see best people to contact to review code\n detailedGitStats - displays a detailed list of git status\n commitsPerDay - displays a list of commits per day\n commitsByMonth - displays a list of commits per month\n commitsByWeekday - displays a list of commits per weekday\n commitsByHour - displays a list of commits per hour\n commitsByAuthorByHour - see a list of commits per hour by author\n commitsPerAuthor - displays a list of commits per author\n myDailyStats - see your current daily stats\n contributors - see a list of all contributors\n branchTree - see an ASCII graph of the git repo\n branchesByDate - show branches by date\n changelogs - see changelogs\n changelogsByAuthor - see changelogs by author\n\nADDITIONAL USAGE\n You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log\n ex: export _GIT_SINCE=2017-20-01\n You can set _GIT_LIMIT for limited output log\n ex: export _GIT_LIMIT=20\n You can exclude a directory from the stats by using pathspec\n ex: export _GIT_PATHSPEC=':!directory'\n \nCONTRIBUTION\n For details regarding contribution, please see the contribution.md document\n\nLICENSE\n This is under the MIT license. See LICENSE in the repo for more info"
|
|
assert "$src fail" "Invalid argument\n\nNAME\n git-quick-stats - Simple and efficient way to access various stats in a git repo\n\nSYNOPSIS\n For non-interactive mode: git-quick-stats [OPTIONS]\n For interactive mode: git-quick-stats\n\nDESCRIPTION\n Any git repository contains tons of information about commits, contributors,\n and files. Extracting this information is not always trivial, mostly because\n of a gadzillion options to a gadzillion git commands.\n\n This program allows you to see detailed information about a git repository.\n\nOPTIONS\n -r, --suggest-reviewers\n show the best people to contact to review code\n -T, --detailed-git-stats\n give a detailed list of git stats\n -d, --commits-per-day\n displays a list of commits per day\n -m, --commits-by-month\n displays a list of commits per month\n -w, --commits-by-weekday\n displays a list of commits per weekday\n -o, --commits-by-hour\n displays a list of commits per hour\n -A, --commits-by-author-by-hour\n displays a list of commits per hour by author\n -a, --commits-per-author\n displays a list of commits per author\n -S, --my-daily-stats\n see your current daily stats\n -C, --contributors\n see a list of everyone who contributed to the repo\n -b, --branch-tree\n show an ASCII graph of the git repo branch history\n -D, --branches-by-date\n show branches by date\n -c, --changelogs\n see changelogs\n -L, --changelogs-by-author\n see changelogs by author\n -h, -?, --help\n display this help text in the terminal\n\nADDITIONAL USAGE\n You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log\n ex: export _GIT_SINCE=\"2017-20-01\"\n You can set _GIT_LIMIT for limited output log\n ex: export _GIT_LIMIT=20\n You can exclude a directory from the stats by using pathspec\n ex: export _GIT_PATHSPEC=':!directory'"
|
|
assert_raises "$src fail" 1
|
|
|
|
assert_contains "$src --suggest-reviewers" "Suggested code reviewers (based on git history)" 127
|
|
assert_raises "$src --suggest-reviewers" 0
|
|
|
|
assert_contains "$src --detailed-git-stats" "Contribution stats" 127
|
|
assert_raises "$src --detailed-git-stats" 0
|
|
|
|
assert_contains "$src --commits-per-day" "Git commits per date" 127
|
|
assert_raises "$src --commits-per-day" 0
|
|
|
|
assert_end
|