skilleter-thingy 0.2.9__py3-none-any.whl → 0.2.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of skilleter-thingy might be problematic. Click here for more details.
- skilleter_thingy/gitprompt.py +36 -26
- {skilleter_thingy-0.2.9.dist-info → skilleter_thingy-0.2.10.dist-info}/METADATA +1 -1
- {skilleter_thingy-0.2.9.dist-info → skilleter_thingy-0.2.10.dist-info}/RECORD +7 -7
- {skilleter_thingy-0.2.9.dist-info → skilleter_thingy-0.2.10.dist-info}/WHEEL +0 -0
- {skilleter_thingy-0.2.9.dist-info → skilleter_thingy-0.2.10.dist-info}/entry_points.txt +0 -0
- {skilleter_thingy-0.2.9.dist-info → skilleter_thingy-0.2.10.dist-info}/licenses/LICENSE +0 -0
- {skilleter_thingy-0.2.9.dist-info → skilleter_thingy-0.2.10.dist-info}/top_level.txt +0 -0
skilleter_thingy/gitprompt.py
CHANGED
|
@@ -74,33 +74,37 @@ MAX_BRANCH_NAME_LENGTH = int(os.environ.get('COLUMNS', 96)) / 3
|
|
|
74
74
|
|
|
75
75
|
################################################################################
|
|
76
76
|
|
|
77
|
-
def
|
|
78
|
-
"""
|
|
77
|
+
def colour_prompt(gitstate: dict):
|
|
78
|
+
""" Return the colour for the prompt, according to the current state of the
|
|
79
79
|
working tree. """
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
output = []
|
|
82
|
+
|
|
83
|
+
output.append('[NORMAL]')
|
|
82
84
|
|
|
83
85
|
if gitstate['modified'] or gitstate['deleted']:
|
|
84
|
-
|
|
86
|
+
output.append('[REVERSE][RED]')
|
|
85
87
|
|
|
86
88
|
elif gitstate['added'] or gitstate['copied'] or gitstate['renamed']:
|
|
87
|
-
|
|
89
|
+
output.append('[REVERSE][YELLOW]')
|
|
88
90
|
|
|
89
91
|
elif gitstate['unmerged']:
|
|
90
|
-
|
|
92
|
+
output.append('[REVERSE][MAGENTA]')
|
|
91
93
|
|
|
92
94
|
elif gitstate['untracked']:
|
|
93
|
-
|
|
95
|
+
output.append('[REVERSE][CYAN]')
|
|
94
96
|
|
|
95
97
|
elif gitstate['merging'] or gitstate['bisecting'] or gitstate['rebasing']:
|
|
96
|
-
|
|
98
|
+
output.append('[REVERSE][BLACK]')
|
|
97
99
|
|
|
98
100
|
else:
|
|
99
|
-
|
|
101
|
+
output.append('[REVERSE][GREEN]')
|
|
102
|
+
|
|
103
|
+
return output
|
|
100
104
|
|
|
101
105
|
################################################################################
|
|
102
106
|
|
|
103
|
-
def
|
|
107
|
+
def prompt_prefix(gitstate: dict):
|
|
104
108
|
""" Build a prompt prefix containing the type and number
|
|
105
109
|
of changes in the repo. """
|
|
106
110
|
|
|
@@ -172,15 +176,14 @@ def write_prompt_prefix(gitstate: dict):
|
|
|
172
176
|
elif gitstate['merging']:
|
|
173
177
|
prefix.append('(merging)')
|
|
174
178
|
|
|
175
|
-
if prefix:
|
|
176
|
-
sys.stdout.write(' {%s}' % ' '.join(prefix))
|
|
177
|
-
|
|
178
179
|
project = git.project(short=True)
|
|
179
180
|
|
|
180
181
|
if project:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
prefix.append(project)
|
|
183
|
+
|
|
184
|
+
prefix.append(branch)
|
|
185
|
+
|
|
186
|
+
return ' '.join(prefix)
|
|
184
187
|
|
|
185
188
|
################################################################################
|
|
186
189
|
|
|
@@ -188,17 +191,19 @@ def git_status(colour_output: str, prompt_output: str):
|
|
|
188
191
|
""" Catalogue the current state of the working tree then call the function
|
|
189
192
|
to either output a suitable colour or the prompt text or both """
|
|
190
193
|
|
|
194
|
+
output = []
|
|
195
|
+
|
|
191
196
|
# Get the working tree, just return if there's an error
|
|
192
197
|
|
|
193
198
|
try:
|
|
194
199
|
working_tree = git.working_tree()
|
|
195
200
|
except git.GitError:
|
|
196
|
-
return
|
|
201
|
+
return None
|
|
197
202
|
|
|
198
203
|
# Return if we are not in a working tree
|
|
199
204
|
|
|
200
205
|
if not working_tree:
|
|
201
|
-
return
|
|
206
|
+
return None
|
|
202
207
|
|
|
203
208
|
# gitstate contains counters for numbers of modified (etc.) elements in the tree and flags to indicate
|
|
204
209
|
# whether we're currently in a merge/rebase/bisect state.
|
|
@@ -212,16 +217,16 @@ def git_status(colour_output: str, prompt_output: str):
|
|
|
212
217
|
gitstate['rebasing'] = git.rebasing()
|
|
213
218
|
gitstate['bisecting'] = git.bisecting()
|
|
214
219
|
|
|
215
|
-
status = git.status()
|
|
220
|
+
status = git.status(untracked=True)
|
|
216
221
|
except git.GitError as exc:
|
|
217
222
|
# Major failure of gitness - report the error and quit
|
|
218
223
|
|
|
224
|
+
msg = exc.msg.split('\n')[0]
|
|
225
|
+
|
|
219
226
|
if colour_output:
|
|
220
|
-
|
|
221
|
-
else:
|
|
222
|
-
colour.write(' ERROR: %s ' % exc.msg.split('\n')[0], newline=False)
|
|
227
|
+
return f'[WHITE][BRED] {msg}'
|
|
223
228
|
|
|
224
|
-
return
|
|
229
|
+
return f' ERROR: {msg} '
|
|
225
230
|
|
|
226
231
|
# Count the number of files in each state
|
|
227
232
|
|
|
@@ -237,10 +242,12 @@ def git_status(colour_output: str, prompt_output: str):
|
|
|
237
242
|
# Set the output colour or output the prompt prefix
|
|
238
243
|
|
|
239
244
|
if colour_output:
|
|
240
|
-
|
|
245
|
+
output += colour_prompt(gitstate)
|
|
241
246
|
|
|
242
247
|
if prompt_output or not colour_output:
|
|
243
|
-
|
|
248
|
+
output.append(prompt_prefix(gitstate))
|
|
249
|
+
|
|
250
|
+
return ''.join(output)
|
|
244
251
|
|
|
245
252
|
################################################################################
|
|
246
253
|
|
|
@@ -253,7 +260,10 @@ def main():
|
|
|
253
260
|
|
|
254
261
|
args = parser.parse_args()
|
|
255
262
|
|
|
256
|
-
git_status(args.colour, args.prompt)
|
|
263
|
+
output = git_status(args.colour, args.prompt)
|
|
264
|
+
|
|
265
|
+
if output:
|
|
266
|
+
colour.write(output, newline=False)
|
|
257
267
|
|
|
258
268
|
################################################################################
|
|
259
269
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: skilleter_thingy
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.10
|
|
4
4
|
Summary: A collection of useful utilities, mainly aimed at making Git more friendly
|
|
5
5
|
Author-email: John Skilleter <john@skilleter.org.uk>
|
|
6
6
|
Project-URL: Home, https://skilleter.org.uk
|
|
@@ -18,7 +18,7 @@ skilleter_thingy/git_review.py,sha256=Z_e0wyQJ2AzOSy5cPI3jmAWystpJbHH4ygENjFagep
|
|
|
18
18
|
skilleter_thingy/git_update.py,sha256=Z3p3E33ZJ2DVa107UzaFR9V8LXADRuHjJL8TX3IhEa4,14348
|
|
19
19
|
skilleter_thingy/git_wt.py,sha256=tkGN_Bfz80icHNDVG8xuXVeUUR-xyZ3u8jopLRt1Ff4,2355
|
|
20
20
|
skilleter_thingy/gitcmp_helper.py,sha256=MlRimPj-S-ov44ETUvocRvfygs3cArP6WdSJCIJWNCs,11347
|
|
21
|
-
skilleter_thingy/gitprompt.py,sha256=
|
|
21
|
+
skilleter_thingy/gitprompt.py,sha256=Ci92A_uVc7gTcv1OwqerN91nBBY8SPvHpFJkYBICf08,8853
|
|
22
22
|
skilleter_thingy/gl.py,sha256=9zbGpKxw6lX9RghLkdy-Q5sZlqtbB3uGFO04qTu1dH8,5954
|
|
23
23
|
skilleter_thingy/linecount.py,sha256=ehTN6VD76i4U5k6dXuYoiqSRHI67_BP-bziklNAJSKY,4309
|
|
24
24
|
skilleter_thingy/multigit.py,sha256=kTxEYinHCH1CQE7hzJF58XH1m-n0NZz5IGOtIJ3nL4Q,33979
|
|
@@ -51,9 +51,9 @@ skilleter_thingy/thingy/run.py,sha256=mqafCzW9op_xKCt8OY3jJ6YltmoOJGh44vzl667mww
|
|
|
51
51
|
skilleter_thingy/thingy/tfm_pane.py,sha256=XTTpSm71CyQyGmlVLuCthioOwech0jhUiFUXb-chS_Q,19792
|
|
52
52
|
skilleter_thingy/thingy/tidy.py,sha256=AQ2RawsZJg6WHrgayi_ZptFL9occ7suSdCHbU3P-cys,5971
|
|
53
53
|
skilleter_thingy/thingy/venv_template.py,sha256=ZfUvi8qFNGrk7J030Zy57xjwMtfIArJyqa-MqafyjVk,1016
|
|
54
|
-
skilleter_thingy-0.2.
|
|
55
|
-
skilleter_thingy-0.2.
|
|
56
|
-
skilleter_thingy-0.2.
|
|
57
|
-
skilleter_thingy-0.2.
|
|
58
|
-
skilleter_thingy-0.2.
|
|
59
|
-
skilleter_thingy-0.2.
|
|
54
|
+
skilleter_thingy-0.2.10.dist-info/licenses/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
|
|
55
|
+
skilleter_thingy-0.2.10.dist-info/METADATA,sha256=cDk-Jv1l9wV5uNDbd8GvHBIzLIJubSp_2NE5ZDaQtKs,28914
|
|
56
|
+
skilleter_thingy-0.2.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
57
|
+
skilleter_thingy-0.2.10.dist-info/entry_points.txt,sha256=MTNWf8jOx8Fy3tSwVLCZPlEyzlDF36odw-IN-cSefP8,1784
|
|
58
|
+
skilleter_thingy-0.2.10.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
|
|
59
|
+
skilleter_thingy-0.2.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|