github-repo 2019.2.23
github repo management
Keywords: github

[![](https://img.shields.io/pypi/pyversions/github-repo.svg?longCache=True)](https://pypi.org/pypi/github-repo/)

#### Install
```bash
$ [sudo] pip install github-repo
```

#### Config
```bash
$ export GITHUB_TOKEN="xxx"
$ cd path/to/repo
```
```python
>>> os.environ["GITHUB_TOKEN"]="xxx"
>>> os.chdir("path/to/repo")
```

#### Functions
function|`__doc__`
-|-
`github_repo.create()`|create github repo
`github_repo.fullname()`|return fullname (owner/repo) string
`github_repo.request(method, url, data=None, **kwargs)`|requests.request
`github_repo.description.get()`|return repo description
`github_repo.description.update(description)`|update repo description
`github_repo.homepage.get()`|return repo homepage
`github_repo.homepage.update(url)`|update repo homepage
`github_repo.remote.add(name, url)`|`git remote add name url`
`github_repo.remote.get()`|return git remote tuple (name, url)
`github_repo.remote.name()`|return git remote name
`github_repo.remote.rm()`|`git remote rm name`
`github_repo.remote.url()`|return git remote url
`github_repo.topics.add(topics)`|add topics
`github_repo.topics.get()`|return topics list
`github_repo.topics.update(topics)`|replace all topics

#### CLI
usage|`__doc__`
-|-
`python -m github_repo.browse`|open github repo in browser
`python -m github_repo.create`|create github repo
`python -m github_repo.description [description]`|get/update description
`python -m github_repo.fullname`|print fullname (owner/repo)
`python -m github_repo.homepage [url]`|get/update homepage
`python -m github_repo.remote.name`|print git remote name
`python -m github_repo.remote.rm`|`git remote rm name`
`python -m github_repo.remote.url`|print git remote url
`python -m github_repo.topics.add topic ...`|add topics to repository
`python -m github_repo.topics.get`|print repository topics
`python -m github_repo.topics.rm`|remove repository topics
`python -m github_repo.topics.update topic ...`|repository topics

### Examples

##### CLI
```bash
$ git remote add github git@github.com:owner/repo.git
$ python -m github_repo.remote.name
github
$ python -m github_repo.remote.url
git@github.com:owner/repo.git
$ python -m github_repo.fullname
owner/repo

$ python -m github_repo.remote.rm  # git remote rm github
```
```bash
$ python -m github_repo.description "new description"
$ python -m github_repo.description
new description
```
```bash
$ python -m github_repo.homepage "https://user.github.io/"
$ python -m github_repo.homepage
https://user.github.io/
```
```bash
$ python -m github_repo.topics.add "python" "pypi"
$ python -m github_repo.topics.get
python
pypi
$ python -m github_repo.topics.update "node" "npm"
$ python -m github_repo.topics.rm
```

##### Functions
```python
>>> github_repo.remote.add("github","git@github.com:owner/repo.git")
>>> github_repo.remote.get() or (None, None)
('github', 'git@github.com:owner/repo.git')
>>> github_repo.remote.name()
'github'
>>> github_repo.remote.url()
'git@github.com:owner/repo.git'
>>> github_repo.fullname()
'owner/repo'

>>> github_repo.remote.rm()
```
```python
>>> github_repo.description.update('new description')
>>> github_repo.description.get()
'new description'
```
```python
>>> github_repo.homepage.update('https://user.github.io/')
>>> github_repo.homepage.get()
'https://user.github.io/'
```
```python
>>> github_repo.topics.add(['python','pypi'])
>>> github_repo.topics.get()
['python','pypi']
>>> github_repo.topics.replace(['node','npm'])
>>> github_repo.topics.rm()
```

<p align="center"><a href="https://pypi.org/project/readme-md/">readme-md</a> - README.md generator</p>