...
 
Commits (2)
## Install
`pip install git+https://git.teonite.net/mkhliestov/update-tracker-cli.git@UPD-20-cli-for-the-system`
\ No newline at end of file
......@@ -12,6 +12,8 @@ setup(
zip_safe=False,
install_requires=[
'confire',
'click==6.7',
'requests==2.18.4',
],
entry_points={
'console_scripts': [
......
......@@ -15,7 +15,7 @@ class ClientConfiguration(Configuration):
token = None
address = 'http://127.0.0.1:8000'
project_id = None
project_id = 0
settings = ClientConfiguration.load()
......
......@@ -27,7 +27,6 @@ def add(ctx, distname, master_site, version):
'master_site': master_site,
'version': version
})
import ipdb; ipdb.set_trace()
click.echo(resp.json()['id'])
......
import click
import sys
import yaml
from .main import settings, session, PROJECT_CONFIG_FILE
......@@ -19,6 +20,7 @@ def start(name):
resp = session.post(url, data={'name': name})
if resp.status_code != 201:
click.get_current_context().fail(message='Failed to create new project')
sys.exit(1)
click.echo(resp.json()['id'])
......@@ -32,10 +34,12 @@ def pin(project_id):
@project.command()
def list():
"""List all tracked projects."""
"""List all tracked projects as tab-delimited name, id, is_pinned. """
url = settings.address + '/api/projects/'
resp = session.get(url).json()
notification_message = ['Name\t ID'] + '\n'.join(
'%s \t%s' % (p['name'], p['id']) for p in resp
)
notification_message = []
for p in resp:
notification_message.append(
'%s\t%s\t%s' % (p['name'], p['id'], int(p['id']) == settings.project_id)
)
click.echo('\n'.join(notification_message))
\ No newline at end of file
import click
import sys
import yaml
from .main import settings, session, USER_CONFIG_FILE
......@@ -23,6 +24,7 @@ def register(email, password):
})
if resp.status_code != 201:
click.echo(resp.json())
sys.exit(1)
else:
click.echo('Please check your email for verification.')
......@@ -40,6 +42,7 @@ def verify(user_uuid, timestamp, signature):
})
if resp.status_code != 200:
click.echo(resp.json())
sys.exit(1)
else:
click.echo(resp.json()['detail'])
......