
from __future__ import print_function

import os

from pygithub3 import Github
from docopt import docopt


def main():
    arguments = docopt(__doc__, version="testing")

    who = arguments['<who>']
    where = arguments['<where>']

    gh = Github()

    repos = gh.repos.list(who).all()

    for repo in repos:
        url = repo.git_url
        print(url, 'to', os.path.join(where, repo.name))
        os.system('git clone ' + url + ' ' + os.path.join(where, repo.name))


if __name__ == '__main__':
    main()


from __future__ import print_function

import os

from pygithub3 import Github
from docopt import docopt


def main():
    arguments = docopt(__doc__, version="1.0")

    who = arguments['<who>']
    where = arguments['<where>']
    ssh = arguments['--ssh']

    gh = Github()

    repos = gh.repos.list(who).all()

    for repo in repos:
        if ssh:
            url = 'git@github.com:' + who + '/' + repo.name
        else:
            url = repo.git_url
        path = os.path.join(where, repo.name)
        print(url, 'to', path)
        os.system('git clone ' + url + ' ' + path)


if __name__ == '__main__':
    main()

Add option to download via SSH
Add option to download via SSH

  
  from __future__ import print_function
  
  import os
  
  from pygithub3 import Github
  from docopt import docopt
  
  
  def main():
-     arguments = docopt(__doc__, version="testing")
+     arguments = docopt(__doc__, version="1.0")
  
      who = arguments['<who>']
      where = arguments['<where>']
+     ssh = arguments['--ssh']
  
      gh = Github()
  
      repos = gh.repos.list(who).all()
  
      for repo in repos:
+         if ssh:
+             url = 'git@github.com:' + who + '/' + repo.name
+         else:
-         url = repo.git_url
+             url = repo.git_url
-         print(url, 'to', os.path.join(where, repo.name))
+         path = os.path.join(where, repo.name)
+         print(url, 'to', path)
-         os.system('git clone ' + url + ' ' + os.path.join(where, repo.name))
+         os.system('git clone ' + url + ' ' + path)
  
  
  if __name__ == '__main__':
      main()
  
Add option to download via SSH
## Code Before:

from __future__ import print_function

import os

from pygithub3 import Github
from docopt import docopt


def main():
    arguments = docopt(__doc__, version="testing")

    who = arguments['<who>']
    where = arguments['<where>']

    gh = Github()

    repos = gh.repos.list(who).all()

    for repo in repos:
        url = repo.git_url
        print(url, 'to', os.path.join(where, repo.name))
        os.system('git clone ' + url + ' ' + os.path.join(where, repo.name))


if __name__ == '__main__':
    main()

## Instruction:
Add option to download via SSH
## Code After:

from __future__ import print_function

import os

from pygithub3 import Github
from docopt import docopt


def main():
    arguments = docopt(__doc__, version="1.0")

    who = arguments['<who>']
    where = arguments['<where>']
    ssh = arguments['--ssh']

    gh = Github()

    repos = gh.repos.list(who).all()

    for repo in repos:
        if ssh:
            url = 'git@github.com:' + who + '/' + repo.name
        else:
            url = repo.git_url
        path = os.path.join(where, repo.name)
        print(url, 'to', path)
        os.system('git clone ' + url + ' ' + path)


if __name__ == '__main__':
    main()
