diff --git a/README.md b/README.md index 4b5c6df..8b6afc3 100644 --- a/README.md +++ b/README.md @@ -13,5 +13,10 @@ Options : * --s: Short form, not showing non-git folders * --l: Show only local repos, which do not have any remotes (includes --s) * --r: Show only repos that have remotes (includes --s) +* --f somestring: Find a local repo by adding a part of the remote url. All matching local repos will be displayed +* --g commands: Git options, passes the string of options in to git, and runs git with those instead of the default remote command + + +Read this [blogpost](http://hermit.no/how-to-list-git-repositores-under-a-common-folder-root/) for more information on how to use it. diff --git a/listgits/listgits.py b/listgits/listgits.py index 7827f18..e30f831 100644 --- a/listgits/listgits.py +++ b/listgits/listgits.py @@ -13,8 +13,11 @@ def listgits(cwd,level,short,local,remotes,isSearch,gitoptions,results): if len(dirs)==0: return root = os.getcwd() + i=0 for dir in dirs: os.chdir(dir) + # print (str(i)) + # i += 1 if os.path.isdir('./.git'): isOptions = len(gitoptions)>0 git = ['git'] @@ -28,6 +31,9 @@ def listgits(cwd,level,short,local,remotes,isSearch,gitoptions,results): if len(stdout[0])==0: if not remotes and not isSearch: print (spc+'Folder '+root+'/'+dir+' has local repo only') + print (' ') + os.chdir(root) + continue if local and len(stderr)>0 and not short: for line in stderr: if len(line)>0: @@ -38,13 +44,17 @@ def listgits(cwd,level,short,local,remotes,isSearch,gitoptions,results): if not isSearch: print (spc+'Folder '+fulldir+' ') for line in stdout: - print (spc+line) + if len(line)>0: + print (spc+line) if isOptions: print('----------') + else: + print (' ') results.append((fulldir,stdout)) else: if not short and not isSearch: print('Folder only: '+ spc+root+'/'+dir) + print (' ') listgits(root,level,short,local,remotes,isSearch,gitoptions,results) os.chdir(root) @@ -83,7 +93,8 @@ def main(): for match in matches: print ('Folder: '+match[0]) for remote in match[1]: - print ('Remote : '+remote) + if len(remote)>0: + print ('Remote : '+remote) print (' ') diff --git a/setup.py b/setup.py index 206c37e..5ef29fd 100644 --- a/setup.py +++ b/setup.py @@ -5,10 +5,10 @@ setuptools.setup( name="listgits", - version="0.6.4", + version="1.0.0", author="Terje Sandstrom", author_email="terje@hermit.no", - description="Python command line program for listing git repositories under a folder root", + description="Python command line program for listing git repositories under a folder root, and optionally run any git command on those repos", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/OsirisTerje/listgits",