Skip to content
This repository was archived by the owner on Aug 11, 2020. It is now read-only.

Commit 9ae08de

Browse files
kossakBartoszCki
authored andcommitted
reorganizing cli command to keep em organized
1 parent 5a1f965 commit 9ae08de

File tree

14 files changed

+1200
-1169
lines changed

14 files changed

+1200
-1169
lines changed

paperspace/cli/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
import colorama
33
from click._compat import get_text_stderr
44

5+
import paperspace.cli.auth
6+
import paperspace.cli.deployments
7+
import paperspace.cli.experiments
58
import paperspace.cli.jobs
9+
import paperspace.cli.machines
610
import paperspace.cli.models
711
import paperspace.cli.projects
812

paperspace/cli/auth.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import click
2+
3+
from paperspace import client, config
4+
from paperspace.cli.cli import cli
5+
from paperspace.cli.validators import validate_email
6+
from paperspace.commands import login as login_commands
7+
8+
9+
@cli.command("login", help="Log in with email and password")
10+
@click.option(
11+
"--email",
12+
"email",
13+
required=True,
14+
callback=validate_email,
15+
help="Email used to create Paperspace account",
16+
)
17+
@click.option(
18+
"--password",
19+
"password",
20+
prompt=True,
21+
hide_input=True,
22+
help="Password used to create Paperspace account",
23+
)
24+
@click.option(
25+
"--apiTokenName",
26+
"api_token_name",
27+
help="Name of api token used to log in",
28+
)
29+
def login(email, password, api_token_name):
30+
machines_api = client.API(config.CONFIG_HOST)
31+
command = login_commands.LogInCommand(api=machines_api)
32+
command.execute(email, password, api_token_name)
33+
34+
35+
@cli.command("logout", help="Log out / remove apiKey from config file")
36+
def logout():
37+
command = login_commands.LogOutCommand()
38+
command.execute()

0 commit comments

Comments
 (0)