Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prettify readme #26

Merged
merged 2 commits into from
Jan 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Dibya Ranjan Jena

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
96 changes: 90 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
# nlt-github
*nlt-github is an open source project which makes sure that you don't have to leave your beloved terminal to upload a new project in Github.*
<p align="center">
<a href="" rel="noopener">
<img height=200px src="logo.png" alt="Briefly-logo"></a>
</p>

![](https://img.shields.io/badge/python-3-blue.svg?style=for-the-badge&logo=python)
<h1 align="center">nlt-github</h1>

<div align="center">

![](https://img.shields.io/badge/python-3-red.svg?style=for-the-badge&logo=python)
[![Gitter](https://img.shields.io/gitter/room/:user/:repo.svg?style=for-the-badge)](https://gitter.im/kwoc_19/nlt-github?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
[![](https://img.shields.io/badge/LICENSE-MIT-orange.svg?style=for-the-badge)](./LICENSE)
[![KWoC 2018](https://img.shields.io/badge/KWoC-2018-0078D6.svg?style=for-the-badge&longCache=true&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAGbElEQVRYhdWWa1BTZxrHH7W1yw4qYcMtIk25lOUWkMgCEhMVq0XQKngDrKy3tkMrVNdxRcssVllbW6e1Wm29tSrdWC8UkUKgBEuuJzn3oLYf2moHrcsGoSoGKcl59kNYCnWcJZp2ps/Mf94vZ+b3O+/znPc9AL/DGg0gHicKl4dNiJRH+EbIAgHkj/8mZFG4fII4OmN+ULxiT0i8UhOSoLoQHK9SBycoXx4XPSX6V4cHxWeUhchUX0tkql6JTOWSyFQuSaKqXyJT2YMTVKf9I1PTAGC09+kBcb6BsdOWPynPvBKWnImhSTOGZdLkmRiWnOkIkamOjQ9PivI2ftRTqXOfyS4sNr20abtz9YZynLNsLUb8ZTZOmjwT0+fm4/LiTfjixgpcvGZ9Z6wip2JCWILIqwbpcwtzPjj2afv1Gx3CvzvsWK/V4YzcIoxV5OC7B49j+/Ub+J/Om9h4Qd//TN6KjwF8A7wqkDInP27voSq6w37T1XuvDxu0Oly0+lXMLnwJ9x6uwq7uH/FOTw+e0zT3Tp2zcAcA+HhVQCKfLs5dXao+fb6xz2BhsKzyHdz+zgeo/qweS8vfwHOaFtQRlFD6WqV9UuyUVQAwxqsCEDw5IHnW4uP7jv7r3pX2a1h1tg637T6Ar+3ah2U730Pu0teoI2ghd2XptaCY1GXehYeG+gQlqNZKZNOvTV9YJOz/SI1GK4smisdWgkYzbUPNBSOWbP0nRqVl9QXFTzvhJ02SAsCoh2aeOnVqjF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+vtgv/bxc6u7qF8l17BWly5j1/aeIRAAh+aDgAAPhJ/QJipm6PUeR0v7X/qGC/2fVAgZ67DuHTmgZXenaBKyA65SvfwPA88MKv2aixIVExgTGpx1LmLLl15JOzrqvt110d9puufqdTcDqdwt27DuFq+w+uZr3FuWBlSX9IvOJ734nR5QAQ+KjwwXo8ICopLFF5YOmaDd+WVe75ceeewz1andmhJ6g7J07X3C5/c9/tdVsqu1Nm5bGisNgyAJjoNfhAjfbxnxgaOVk5P3na3PWzFhRULH7+hR1Zuctfn/1c/o6ZOUsqUpRZG6NlKc8CgNjb8GEi4D5SfQDgj79Yn4CHmPj/Ah8OBXTGJ+jbAAAAAElFTkSuQmCC)](https://kwoc.kossiitkgp.org/)
[![contribution](https://img.shields.io/badge/contibutions-welcome-green.svg?style=for-the-badge)](https://github.com/dibyasonu/nlt-github/pulls)


<h4>nlt-github is an open source project which makes sure that you don't have to leave your beloved terminal to upload a new project in Github</h4>
</div>

------------------------------------------
### Demo
<p align="center">
<img src="./demo.gif">
</p>

## Installation
`$ git clone https://github.com/dibyasonu/nlt-github.git`
Expand Down Expand Up @@ -47,9 +66,13 @@ Options:
--help Show this message and exit.
Commands:
add Add required files.
config Configure Users.
create-remote create a new repo in Github and add remote origin to the local project.
add Add required files
config Configure Users
create-remote create a new repo in Github and add remote origin to the
local project.
list-repos view list of repositories belonging to the user.
pr list pull requests of current repository
view-profile view basic info of any particular user.
```

#### Add required files
Expand Down Expand Up @@ -93,3 +116,64 @@ Options:
--username TEXT provide username in whose account the new repo is to be created.
--privy create a private repository if used.
```
#### List repo

`$ nlt list-repos --help`

```
Usage: nlt list-repos [OPTIONS]
view list of repositories belonging to the user, private repositories can
also be listed if user is configured.
Options:
--username TEXT provide username in whose repos are to be listed.
--all specify if private repos are needed,in that case username
must be configured.
--help Show this message and exit.
```
#### Handle Pull Request

`$ nlt pr --help`

```
Usage: nlt pr [OPTIONS]
list open pull requests at remote of current git repository test them,
merge them or comment on the thread
Options:
--help Show this message and exit.
```
#### View Profile

`$ nlt view-profile --help`

```
Usage: nlt view-profile [OPTIONS]
view basic profile information of a particular user
Options:
--username TEXT provide username in whose info is needed.
--all specify if private repos count is needed,in that case
username must be configured.
--help Show this message and exit.
```
------------------------------------------
### Contributing

* We're are open to `enhancements` & `bug-fixes` :smile:.
* Feel free to add issues and submit patches

------------------------------------------
### Author
Dibya Ranjan Jena - [dibyasonu](https://github.com/dibyasonu)

See also the list of [contributors](https://github.com/dibyasonu/nlt-github/graphs/contributors) who participated in this project.

------------------------------------------
### License
This project is licensed under the MIT - see the [LICENSE](./LICENSE) file for details


Binary file added demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions licenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import requests
import click
import json
import sys
from subprocess import call, STDOUT


Expand Down
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 38 additions & 10 deletions nlt_gb.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,10 @@ def get_languages(cwd,options,language_ext,list_of_lang=[]):


@cli.command('create-remote',short_help='create a new repo in Github and add remote origin to the local project.')
@click.option('--username',prompt=True,help='provide username in whose account the new repo is to be created.')
@click.option('--username',default='default',prompt=True,help='provide username in whose account the new repo is to be created.')
@click.option('--privy',is_flag=bool,default=False,help="create a private repository if used.")
def push_remote(username,privy):
data=file_handler()

if username in data.keys():
proname=click.prompt('Please enter the Project name')
desc=click.prompt('A short description of the repository.')
Expand Down Expand Up @@ -130,7 +129,8 @@ def push_remote(username,privy):
@click.option('--adduser',is_flag=bool,default=False,help="Creates a personal access token in github and stores them locally.")
@click.option('--deluser',is_flag=bool,default=False,help="Remove created personal access token from github and locally.")
@click.option('--showusers',is_flag=bool,default=False,help="Show added users.")
def user_config(adduser,deluser,showusers):
@click.option('--setdefault',is_flag=bool,default=False,help="add default users.")
def user_config(adduser,deluser,showusers,setdefault):
data=file_handler()
# if admin:

Expand All @@ -154,6 +154,8 @@ def user_config(adduser,deluser,showusers):

if response.status_code==201:
data[user_name]=[response.json()['token'],response.json()['url']]
if click.confirm('Do you want to add this account as default account ?'):
data['default']=[response.json()['token'],response.json()['url'],user_name]

file_handler(data)
click.secho('user added succesfully',bold=True,fg='green')
Expand All @@ -170,8 +172,9 @@ def user_config(adduser,deluser,showusers):
response=requests.delete(data[user_name][1], auth=(user_name, password))

if response.status_code==204:
if 'default' in data and data['default'][2]==user_name:
data.pop('default')
data.pop(user_name)

file_handler(data)
click.secho('user deleted succesfully',bold=True,fg='green')
else:
Expand All @@ -180,14 +183,29 @@ def user_config(adduser,deluser,showusers):
click.secho('user not found',bold=True,fg='red')

if showusers:
users=[x for x in data]

users=[x for x in data if x != 'default']
if 'default' in data:
default = data['default'][2]
else:
default = None
if len(users):
for i in users:
click.secho(i,bold=True,fg='blue')
if i!=default:
click.secho(i,bold=True,fg='blue')
else:
click.secho(i+" *",bold=True,fg='blue')
else:
click.secho('No users added. Add users by running "nlt config --adduser"',bold=True,fg='red')
#checks users as well as their status and generate the status
#checks users as well as their status and generate the status

if setdefault:
user_name=click.prompt('Please enter your Github user name')
if user_name in data.keys():
data['default'] = data[user_name]+[user_name]
file_handler(data)
click.secho('default user added',bold=True,fg='yellow')
else:
click.secho('user not found',bold=True,fg='red')

@cli.command('add',help="Add required files")
@click.option('--license',is_flag=bool,default=False,help="Add license templates from the list to your project.")
Expand Down Expand Up @@ -259,21 +277,31 @@ def add(license, gitignore, readme):
pass

@cli.command('list-repos',short_help='view list of repositories belonging to the user.')
@click.option('--username',prompt=True,help='provide username in whose repos are to be listed.')
@click.option('--username',default='default',prompt=True,help='provide username in whose repos are to be listed.')
@click.option('--all',is_flag=bool,default=False,help='specify if private repos are needed,in that case username must be configured.')
def list_repos(username,all):
'''
view list of repositories belonging to the user, private repositories can also be listed if user is configured.
'''
data = file_handler()
user_profile.display_repo(data,username,all)


@cli.command('view-profile',short_help='view basic info of any particular user.')
@click.option('--username',prompt=True,help='provide username in whose info is needed.')
@click.option('--username',default='default',prompt=True,help='provide username in whose info is needed.')
@click.option('--all',is_flag=bool,default=False,help='specify if private repos count is needed,in that case username must be configured.')
def list_repos(username,all):
'''
view basic profile information of a particular user
'''
data = file_handler()
user_profile.display_profile(data,username,all)

@cli.command('pr',short_help='list pull requests of current repository')
def list_pr():
'''
list open pull requests at remote of current git repository test them, merge them or comment on the thread
'''
repo = Repo(os.getcwd())
assert not repo.bare
url = repo.remotes.origin.url
Expand Down