Skip to content

Commit

Permalink
better bash completions, interactive running
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Apr 3, 2016
1 parent d308064 commit ad968b6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
9 changes: 9 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ copies:
git fame --incl '\.[cht][puh]{0,2}$' -twMC
It is also possible to run from within a python shell or script.

.. code:: python
>>> import gitfame
>>> import sys
>>> sys.argv = ['', '--sort=commits', '-wt', './path/to/my/repo']
>>> gitfame.main()
Documentation
-------------
Expand Down
21 changes: 8 additions & 13 deletions git-fame_completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,19 @@ _git_fame()
prv="${COMP_WORDS[COMP_CWORD-1]}"
case ${COMP_CWORD} in
1)
COMPREPLY=($(compgen -cW "fame" ${cur}))
COMPREPLY=($(compgen -W "fame" ${cur}))
;;
2)
case ${prv} in
fame)
COMPREPLY=($(compgen -W '-h --help -v --version --sort --incl --excl -n --no-regex -s --silent-progress -t --bytype -w --ignore-whitespace -M -C' -- ${cur}))
;;
esac
;;
3)
*)
case ${prv} in
"--"sort)
"--sort")
COMPREPLY=($(compgen -W 'loc commits files' -- ${cur}))
;;
*)
if [ ${COMP_WORDS[1]} == fame ]; then
COMPREPLY=($(compgen -dW '-h --help -v --version --sort --incl --excl -n --no-regex -s --silent-progress -t --bytype -w --ignore-whitespace -M -C' -- ${cur}))
fi
;;
esac
;;
*)
COMPREPLY=()
;;
esac
}
1 change: 1 addition & 0 deletions gitfame/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from ._gitfame import __copyright__
from ._gitfame import __version__
from ._gitfame import __license__
from ._gitfame import main

__all__ = ['main', '__author__', '__date__', '__licence__', '__copyright__',
'__version__', '__license__']

0 comments on commit ad968b6

Please sign in to comment.