Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Terje Sandstrom committed Dec 6, 2019
1 parent 266a54c commit ed8bb95
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


15 changes: 13 additions & 2 deletions listgits/listgits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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:
Expand All @@ -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)

Expand Down Expand Up @@ -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 (' ')


Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

setuptools.setup(
name="listgits",
version="0.6.4",
version="1.0.0",
author="Terje Sandstrom",
author_email="[email protected]",
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",
Expand Down

0 comments on commit ed8bb95

Please sign in to comment.