New default theme with toggle-able legacy theme

* This sets the newly proposed theme as the main theme. In order to
  switch back to the legacy theme, set _MENU_THEME to legacy.
  This feature is currently an experimental feature and may change
  in the future.

* Fixes documentation and updates test to reflect newly changed theme.
This commit is contained in:
Tom Ice
2019-05-12 19:32:11 -04:00
parent 90d118f09f
commit bdfe3beb25
4 changed files with 36 additions and 33 deletions

View File

@@ -117,10 +117,10 @@ export _GIT_PATHSPEC=':!directory'
#### Color themes
You can change to an alternative color scheme by toggling the variable `_MENU_THEME` between `default` and `alternative`
You can change to the legacy color scheme by toggling the variable `_MENU_THEME` between `default` and `legacy`
```bash
export _MENU_THEME=alternative
export _MENU_THEME=legacy
```
## Installation

View File

@@ -25,7 +25,7 @@ else
fi
# Default menu theme
# Set an alternative by typing "export _MENU_THEME=alternative"
# Set the legacy theme by typing "export _MENU_THEME=legacy"
_theme="${_MENU_THEME:=default}"
################################################################################
@@ -116,8 +116,8 @@ ADDITIONAL USAGE
ex: export _GIT_LIMIT=20
You can exclude a directory from the stats by using pathspec
ex: export _GIT_PATHSPEC=':!directory'
You can set _MENU_THEME to display an alternative color scheme
ex: export _MENU_THEME=alternative"
You can set _MENU_THEME to display the legacy color scheme
ex: export _MENU_THEME=legacy"
}
################################################################################
@@ -136,39 +136,42 @@ function show_menu() {
local text=""
local nums=""
local help_txt=""
local exit_txt=""
# Adjustable color menu option
if [[ "${_theme}" == "alternative" ]]; then
titles="${bold}${cyan}"
text="${normal}${white}"
nums="${bold}${white}"
help_txt="${cyan}"
else
if [[ "${_theme}" == "legacy" ]]; then
titles="${bold}${red}"
text="${normal}${cyan}"
nums="${bold}${yellow}"
help_txt="${white}"
help_txt="${normal}${yellow}"
exit_txt="${bold}${red}"
else
titles="${bold}${cyan}"
text="${normal}${white}"
nums="${normal}${bold}${white}"
help_txt="${normal}${cyan}"
exit_txt="${bold}${cyan}"
fi
echo -e "\n${titles} Generate:${normal}"
echo -e "${nums} 1)${text} Contribution stats (by author)${normal}"
echo -e "${nums} 2)${text} Contribution stats (by author) on a specific branch${normal}"
echo -e "${nums} 3)${text} Git changelogs (last $_limit days)${normal}"
echo -e "${nums} 4)${text} Git changelogs by author${normal}"
echo -e "${nums} 5)${text} My daily status${normal}"
echo -e "\n${titles} List:${normal}"
echo -e "${nums} 6)${text} Branch tree view (last $_limit)${normal}"
echo -e "${nums} 7)${text} All branches (sorted by most recent commit)${normal}"
echo -e "${nums} 8)${text} All contributors (sorted by name)${normal}"
echo -e "${nums} 9)${text} Git commits per author${normal}"
echo -e "${nums} 10)${text} Git commits per date${normal}"
echo -e "${nums} 11)${text} Git commits per month${normal}"
echo -e "${nums} 12)${text} Git commits per weekday${normal}"
echo -e "${nums} 13)${text} Git commits per hour${normal}"
echo -e "${nums} 14)${text} Git commits by author per hour${normal}"
echo -e "\n${titles} Suggest${normal}:"
echo -e "${nums} 15)${text} Code reviewers (based on git history)${normal}"
echo -e "\n${help_txt}Please enter a menu option or ${bold}press Enter to exit.${normal}"
echo -e "${nums} 1)${text} Contribution stats (by author)"
echo -e "${nums} 2)${text} Contribution stats (by author) on a specific branch"
echo -e "${nums} 3)${text} Git changelogs (last $_limit days)"
echo -e "${nums} 4)${text} Git changelogs by author"
echo -e "${nums} 5)${text} My daily status"
echo -e "\n${titles} List:"
echo -e "${nums} 6)${text} Branch tree view (last $_limit)"
echo -e "${nums} 7)${text} All branches (sorted by most recent commit)"
echo -e "${nums} 8)${text} All contributors (sorted by name)"
echo -e "${nums} 9)${text} Git commits per author"
echo -e "${nums} 10)${text} Git commits per date"
echo -e "${nums} 11)${text} Git commits per month"
echo -e "${nums} 12)${text} Git commits per weekday"
echo -e "${nums} 13)${text} Git commits per hour"
echo -e "${nums} 14)${text} Git commits by author per hour"
echo -e "\n${titles} Suggest:"
echo -e "${nums} 15)${text} Code reviewers (based on git history)"
echo -e "\n${help_txt}Please enter a menu option or ${exit_txt}press Enter to exit."
echo -n "${text}> ${normal}"
read -r opt
}

View File

@@ -113,9 +113,9 @@ You can exclude a directory from the stats by using pathspec, example:
.PP
.B export _GIT_PATHSPEC=':!directory'
.PP
You can switch to an alternative color scheme, example:
You can switch to the legacy color scheme, example:
.PP
.B export _MENU_THEME=alternative
.B export _MENU_THEME=legacy
.
.fi

View File

@@ -4,7 +4,7 @@
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 -R, --git-stats-by-branch\n see detailed list of git stats by branch\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'\n You can set _MENU_THEME to display an alternative color scheme\n ex: export _MENU_THEME=alternative"
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 -R, --git-stats-by-branch\n see detailed list of git stats by branch\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'\n You can set _MENU_THEME to display the legacy color scheme\n ex: export _MENU_THEME=legacy"
assert_raises "$src fail" 1
assert_contains "$src --suggest-reviewers" "Suggested code reviewers (based on git history)" 127