Add bash autocomplete code.

Add bash autocomplete code based on the argcomplete package.
The file 'bash_completion/hpgit' should be copied in
'/etc/bash_completion.d/' but this require root priviledges.

Change-Id: I2c6133a0d9677d6f91fd6c96ceb4e84eda3c75ac
JIRA: CICD-261
This commit is contained in:
Davide Guerri 2013-11-15 17:06:23 +00:00
parent a03c2a0566
commit e666f2f1b0
4 changed files with 5 additions and 1 deletions

1
bash_completion/hpgit Normal file
View File

@ -0,0 +1 @@
eval "$(register-python-argcomplete git-hp)"

View File

@ -24,6 +24,7 @@ import ghp.version
import subcommand
import argparse
from argparse import ArgumentParser
import argcomplete
import logging
import sys
@ -92,6 +93,7 @@ def main(argv):
help(parser, argv)
return 0
argcomplete.autocomplete(parser)
args = parser.parse_args()
if args.func == help:
help(parser, args, cmds)

1
git-hp
View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
#PYTHON_ARGCOMPLETE_OK
#
# Copyright (c) 2012 Hewlett-Packard
#

View File

@ -33,7 +33,7 @@ setup(
url="https://wiki.hpcloud.net/display/auto/hpgit",
scripts=['git-hp'],
packages=find_packages(exclude=['test']),
install_requires=['GitPython'],
install_requires=['GitPython','argcomplete'],
long_description=read('README'),
classifiers=[
"Development Status :: 2 - Pre-Alpha",