Compare commits

...

6 Commits
2.0.6 ... 2.0.7

Author SHA1 Message Date
Tom Ice
81fce5cadf Updating README.md to reflect new theme(s) 2019-05-13 10:35:59 -04:00
Tom Ice
f3931eb1a3 Merge pull request #65 from Calinou/improve-interactive-menu
Improve the interactive menu
2019-05-13 10:31:03 -04:00
Tom Ice
bdfe3beb25 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.
2019-05-12 19:32:11 -04:00
Tom Ice
90d118f09f Fixing some menu color issues 2019-05-10 22:55:42 -04:00
Tom Ice
d12c1c6c4f Added color scheme toggle-ability and updated docs
* You can now switch between the default theme and an alternative theme
  for those who would like a different look to the interactive menu.
  In order to set this, simply do export _MENU_THEME=alternative. Anything
  that isn't "alternative" will simply fall back to the default menu option.

* Fixed merge conflicts based on the latest master branch which added the
  contribution stats by branch option.

* Fixed tests, updated docs, and all that fun stuff.
2019-05-10 16:17:42 -04:00
Hugo Locurcio
749367701d Improve the interactive menu
This adds a `>` at the end of the message to denote the program
is waiting for user input.

This also tweaks colors for better readability.
2019-04-11 14:40:16 +02:00
4 changed files with 66 additions and 25 deletions

View File

@@ -5,7 +5,7 @@
> Any git repository contains tons of information about commits, contributors, and files. Extracting this information is not always trivial, mostly because of a gadzillion options to a gadzillion git commands I dont think there is a single person alive who knows them all. Probably not even [Linus Torvalds](https://github.com/torvalds) himself :).
![mainMenuScreenshot](https://user-images.githubusercontent.com/8818630/57544421-4891a700-7325-11e9-9cdd-034a6619ae0f.png)
![mainMenuScreenshot](https://user-images.githubusercontent.com/8818630/57629726-4704f080-756a-11e9-89cc-f8bdeea3c982.png)
## Table of Contents
@@ -35,9 +35,9 @@
## Screenshots
![commitsByWeekdayScreenshot](https://user-images.githubusercontent.com/8818630/57544420-4891a700-7325-11e9-876a-15df90bce420.png)
![commitsByWeekdayScreenshot](https://user-images.githubusercontent.com/8818630/57629719-42d8d300-756a-11e9-8031-8132e14aa10f.png)
![commitsByHourScreenshot](https://user-images.githubusercontent.com/8818630/57544419-47f91080-7325-11e9-82d3-57e4f98be240.png)
![commitsByHourScreenshot](https://user-images.githubusercontent.com/8818630/57629717-40767900-756a-11e9-97d4-301ffe7535c7.png)
## Usage
@@ -115,6 +115,14 @@ You can exclude directory from the stats by using [pathspec](https://git-scm.com
export _GIT_PATHSPEC=':!directory'
```
#### Color themes
You can change to the legacy color scheme by toggling the variable `_MENU_THEME` between `default` and `legacy`
```bash
export _MENU_THEME=legacy
```
![legacyThemeScreenshot](https://user-images.githubusercontent.com/8818630/57629724-453b2d00-756a-11e9-9ffc-6a7f53c5fc49.png)
## Installation

View File

@@ -24,6 +24,10 @@ else
_limit=10
fi
# Default menu theme
# Set the legacy theme by typing "export _MENU_THEME=legacy"
_theme="${_MENU_THEME:=default}"
################################################################################
# DESC: Checks to make sure the user has the appropriate utilities installed
# ARGS: None
@@ -111,7 +115,9 @@ ADDITIONAL USAGE
You can set _GIT_LIMIT for limited output log
ex: export _GIT_LIMIT=20
You can exclude a directory from the stats by using pathspec
ex: export _GIT_PATHSPEC=':!directory'"
ex: export _GIT_PATHSPEC=':!directory'
You can set _MENU_THEME to display the legacy color scheme
ex: export _MENU_THEME=legacy"
}
################################################################################
@@ -122,28 +128,51 @@ ADDITIONAL USAGE
function show_menu() {
local normal=$(tput sgr0)
local cyan=$(tput setaf 6)
local bold=$(tput bold)
local red=$(tput setaf 1)
local yellow=$(tput setaf 3)
echo -e "\n${red} Generate: ${normal}"
echo -e "${cyan} ${yellow} 1)${cyan} Contribution stats (by author) ${normal}"
echo -e "${cyan} ${yellow} 2)${cyan} Contribution stats (by author) on a specific branch ${normal}"
echo -e "${cyan} ${yellow} 3)${cyan} Git changelogs (last $_limit days)${normal}"
echo -e "${cyan} ${yellow} 4)${cyan} Git changelogs by author ${normal}"
echo -e "${cyan} ${yellow} 5)${cyan} My daily status ${normal}"
echo -e "${red} List: ${normal}"
echo -e "${cyan} ${yellow} 6)${cyan} Branch tree view (last $_limit)${normal}"
echo -e "${cyan} ${yellow} 7)${cyan} All branches (sorted by most recent commit) ${normal}"
echo -e "${cyan} ${yellow} 8)${cyan} All contributors (sorted by name) ${normal}"
echo -e "${cyan} ${yellow} 9)${cyan} Git commits per author ${normal}"
echo -e "${cyan} ${yellow} 10)${cyan} Git commits per date ${normal}"
echo -e "${cyan} ${yellow} 11)${cyan} Git commits per month ${normal}"
echo -e "${cyan} ${yellow} 12)${cyan} Git commits per weekday ${normal}"
echo -e "${cyan} ${yellow} 13)${cyan} Git commits per hour ${normal}"
echo -e "${cyan} ${yellow} 14)${cyan} Git commits by author per hour ${normal}"
echo -e "${red} Suggest: ${normal}"
echo -e "${cyan} ${yellow} 15)${cyan} Code reviewers (based on git history) ${normal}"
echo -e "\n${yellow}Please enter a menu option or ${red}press enter to exit. ${normal}"
local white=$(tput setaf 7)
local titles=""
local text=""
local nums=""
local help_txt=""
local exit_txt=""
# Adjustable color menu option
if [[ "${_theme}" == "legacy" ]]; then
titles="${bold}${red}"
text="${normal}${cyan}"
nums="${bold}${yellow}"
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)"
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

@@ -112,6 +112,10 @@ You can set _GIT_LIMIT for limited output log, example:
You can exclude a directory from the stats by using pathspec, example:
.PP
.B export _GIT_PATHSPEC=':!directory'
.PP
You can switch to the legacy color scheme, example:
.PP
.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'"
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