2
2
from pathlib import Path
3
3
4
4
import click
5
+ from click_help_colors import HelpColorsGroup , HelpColorsCommand
5
6
6
7
from igit .core .commands import Igit
7
8
8
9
9
- @click .group ()
10
+ @click .group (
11
+ cls = HelpColorsGroup ,
12
+ help_headers_color = 'yellow' ,
13
+ help_options_color = 'magenta' ,
14
+ help_options_custom_colors = {
15
+ 'up' : 'cyan' ,
16
+ 'push' : 'cyan' ,
17
+ 'undo' : 'red' ,
18
+ 'unstage' : 'red' ,
19
+ 'revert' : 'red' ,
20
+ 'diff' : 'green' ,
21
+ 'branch' : 'green' ,
22
+ 'add' : 'blue' ,
23
+ 'commit' : 'blue' ,
24
+ 'save' : 'blue' ,
25
+ }
26
+ )
10
27
def cli ():
28
+ """\b
29
+ _____ __________
30
+ ___(_)______ ___(_)_ /_
31
+ __ /__ __ `/_ /_ __/
32
+ _ / _ /_/ /_ / / /_
33
+ /_/ _\__, / /_/ \__/
34
+ /____/
11
35
"""
12
- Interactive Git for better git experience.
13
- """
14
- pass
15
36
16
37
17
- @cli .command (help = 'add unstaged files' )
38
+ @cli .command (
39
+ help = 'Add unstaged files.'
40
+ )
18
41
@click .option ('--file' , default = [], help = 'file to add' , multiple = True )
19
42
@click .option ('--all' , '-a' , is_flag = True , default = False , help = 'add all unstaged files' )
20
43
def add (file , all ):
21
44
Igit ().add (file , all )
22
45
23
46
24
- @cli .command (help = 'commit changes' )
47
+ @cli .command (help = 'Commit changes. ' )
25
48
@click .option ('--message' , '-m' , default = None , help = 'commit message' )
26
49
@click .option ('--add' , '-a' , is_flag = True , default = False , help = 'add before commit' )
27
50
def commit (message , add ):
28
51
Igit ().commit (message , add )
29
52
30
53
31
- @cli .command (help = 'push changes' )
54
+ @cli .command (help = 'Push changes. ' )
32
55
@click .option ('--add' , '-a' , is_flag = True , default = False , help = 'add --all and commit before push' )
33
56
@click .option ('--commit' , '-c' , is_flag = True , default = False , help = 'push to remote' )
34
57
def push (add , commit ):
35
58
Igit ().push (add , commit )
36
59
37
60
38
- @cli .command (help = 'Adds and Commits changes' )
61
+ @cli .command (help = 'Adds and Commits changes. ' )
39
62
@click .option ('--message' , default = None , help = 'commit message (optional)' )
40
63
def save (message ):
41
64
Igit ().save (message )
42
65
43
66
44
- @cli .command (help = 'Adds, Commits and Pushes changes to remote' )
67
+ @cli .command (help = 'Adds, Commits and Pushes changes to remote. ' )
45
68
@click .option ('--message' , default = None , help = 'commit message (optional)' )
46
69
def up (message ):
47
70
Igit ().up (message )
48
71
49
72
50
- @cli .command (help = 'Switch to another branch' )
73
+ @cli .command (help = 'Switch to another branch. ' )
51
74
@click .option ('--name' , '-n' , default = None , help = 'target branch to switch to' )
52
75
@click .option ('--hopping_on' , '-h' , is_flag = True , default = False , help = 'activate branch hopping' )
53
76
def branch (name , hopping_on ):
54
77
return Igit ().branch (name , hopping_on )
55
78
56
79
57
- @cli .command (help = 'Prints diff of selected file' )
80
+ @cli .command (help = 'Prints diff of selected file. ' )
58
81
def diff ():
59
82
return Igit ().diff ()
60
83
61
84
62
- @cli .command (help = 'Undo un-staged (non added) changes' )
85
+ @cli .command (help = 'Undo un-staged (non added) changes. ' )
63
86
@click .option ('--file' , default = [], help = 'file to add' , multiple = True )
64
87
@click .option ('--all' , is_flag = True , default = False , help = 'undo all unstaged changes' )
65
88
def undo (file , all ):
66
89
return Igit ().undo (file , all )
67
90
68
91
69
- @cli .command (help = 'Unstage changes' )
92
+ @cli .command (help = 'Unstage changes. ' )
70
93
@click .option ('--file' , default = [], help = 'file to add' , multiple = True )
71
94
@click .option ('--all' , is_flag = True , default = False , help = 'unstage all files' )
72
95
def unstage (file , all ):
73
96
return Igit ().unstage (file , all )
74
97
75
98
76
- @cli .command (help = 'revert commit (NOT IMPLEMENTED)' )
99
+ @cli .command (help = 'Revert commit (NOT IMPLEMENTED). ' )
77
100
def revert ():
78
101
# TODO - implement
79
102
return 'NOT IMPLEMENTED'
80
103
81
104
82
- @cli .command (help = 'Rename current branch' )
105
+ @cli .command (help = 'Rename current branch. ' )
83
106
@click .argument ('name' )
84
107
def rename (name ):
85
108
return Igit ().rename (name )
@@ -91,7 +114,7 @@ def ignore(reset):
91
114
return Igit ().ignore (reset )
92
115
93
116
94
- @cli .command (help = 'Print igit version' )
117
+ @cli .command (help = 'Prints igit version. ' )
95
118
def version ():
96
119
here = Path (__file__ ).parent .absolute ()
97
120
package_conf = {}
0 commit comments