-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.py
More file actions
47 lines (37 loc) · 1.08 KB
/
cli.py
File metadata and controls
47 lines (37 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import click
from wit import Wit
class Cli:
def __init__(self):
self.wit = Wit()
def create_cli(self):
@click.group()
def cli():
pass
cli()
cli.add_command(self.init_cmd, name='init')
cli.add_command(self.add_cmd, name='add')
cli.add_command(self.log_cmd, name='log')
cli.add_command(self.status_cmd, name='status')
cli.add_command(self.checkout_cmd, name='checkout')
cli.add_command(self.commit_cmd, name='commit')
@click.command()
def init_cmd(self):
self.wit.init()
@click.command()
@click.argument('file_name')
def add_cmd(self, file_name):
self.wit.add(file_name)
@click.command()
def log_cmd(self):
self.wit.log()
@click.command()
def status_cmd(self):
self.wit.status()
@click.command()
@click.argument('commit_id')
def checkout_cmd(self, commit_id):
self.wit.checkout(commit_id)
@click.command()
@click.argument('message')
def commit_cmd(self, message):
self.wit.commit(message)