Skip to content

Commit a509667

Browse files
committed
fast commit
1 parent 3091224 commit a509667

File tree

7 files changed

+269
-215
lines changed

7 files changed

+269
-215
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ RUN sudo apt -y install python3-pip && \
1919
WORKDIR /home/igit
2020
COPY Pipfile .
2121
COPY Pipfile.lock .
22-
RUN pipenv install
22+
RUN pipenv install --dev
2323

2424
COPY . .
2525
RUN pipenv install --skip-lock -e .

Pipfile

+5-7
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,21 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[dev-packages]
7+
pytest = "*"
8+
pylint = "*"
79

810
[packages]
9-
fire = "*"
1011
termcolor = "*"
11-
pyyaml = "*"
12-
pytest = "*"
1312
gitpython = "*"
13+
pyinquirer = "*"
1414
inquirer = "*"
1515
emoji = "*"
16-
pylint = "*"
17-
pyinquirer = "*"
1816
gitignore-parser = "*"
1917
psutil = "*"
20-
python-dotenv = "*"
21-
click = "*"
2218
pathlib2 = "*"
19+
click = "*"
2320
invoke = "*"
21+
click-help-colors = "*"
2422

2523
[requires]
2624
python_version = "3.7"

Pipfile.lock

+187-179
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

igit/cli.py

+39-16
Original file line numberDiff line numberDiff line change
@@ -2,84 +2,107 @@
22
from pathlib import Path
33

44
import click
5+
from click_help_colors import HelpColorsGroup, HelpColorsCommand
56

67
from igit.core.commands import Igit
78

89

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+
)
1027
def cli():
28+
"""\b
29+
_____ __________
30+
___(_)______ ___(_)_ /_
31+
__ /__ __ `/_ /_ __/
32+
_ / _ /_/ /_ / / /_
33+
/_/ _\__, / /_/ \__/
34+
/____/
1135
"""
12-
Interactive Git for better git experience.
13-
"""
14-
pass
1536

1637

17-
@cli.command(help='add unstaged files')
38+
@cli.command(
39+
help='Add unstaged files.'
40+
)
1841
@click.option('--file', default=[], help='file to add', multiple=True)
1942
@click.option('--all', '-a', is_flag=True, default=False, help='add all unstaged files')
2043
def add(file, all):
2144
Igit().add(file, all)
2245

2346

24-
@cli.command(help='commit changes')
47+
@cli.command(help='Commit changes.')
2548
@click.option('--message', '-m', default=None, help='commit message')
2649
@click.option('--add', '-a', is_flag=True, default=False, help='add before commit')
2750
def commit(message, add):
2851
Igit().commit(message, add)
2952

3053

31-
@cli.command(help='push changes')
54+
@cli.command(help='Push changes.')
3255
@click.option('--add', '-a', is_flag=True, default=False, help='add --all and commit before push')
3356
@click.option('--commit', '-c', is_flag=True, default=False, help='push to remote')
3457
def push(add, commit):
3558
Igit().push(add, commit)
3659

3760

38-
@cli.command(help='Adds and Commits changes')
61+
@cli.command(help='Adds and Commits changes.')
3962
@click.option('--message', default=None, help='commit message (optional)')
4063
def save(message):
4164
Igit().save(message)
4265

4366

44-
@cli.command(help='Adds, Commits and Pushes changes to remote')
67+
@cli.command(help='Adds, Commits and Pushes changes to remote.')
4568
@click.option('--message', default=None, help='commit message (optional)')
4669
def up(message):
4770
Igit().up(message)
4871

4972

50-
@cli.command(help='Switch to another branch')
73+
@cli.command(help='Switch to another branch.')
5174
@click.option('--name', '-n', default=None, help='target branch to switch to')
5275
@click.option('--hopping_on', '-h', is_flag=True, default=False, help='activate branch hopping')
5376
def branch(name, hopping_on):
5477
return Igit().branch(name, hopping_on)
5578

5679

57-
@cli.command(help='Prints diff of selected file')
80+
@cli.command(help='Prints diff of selected file.')
5881
def diff():
5982
return Igit().diff()
6083

6184

62-
@cli.command(help='Undo un-staged (non added) changes')
85+
@cli.command(help='Undo un-staged (non added) changes.')
6386
@click.option('--file', default=[], help='file to add', multiple=True)
6487
@click.option('--all', is_flag=True, default=False, help='undo all unstaged changes')
6588
def undo(file, all):
6689
return Igit().undo(file, all)
6790

6891

69-
@cli.command(help='Unstage changes')
92+
@cli.command(help='Unstage changes.')
7093
@click.option('--file', default=[], help='file to add', multiple=True)
7194
@click.option('--all', is_flag=True, default=False, help='unstage all files')
7295
def unstage(file, all):
7396
return Igit().unstage(file, all)
7497

7598

76-
@cli.command(help='revert commit (NOT IMPLEMENTED)')
99+
@cli.command(help='Revert commit (NOT IMPLEMENTED).')
77100
def revert():
78101
# TODO - implement
79102
return 'NOT IMPLEMENTED'
80103

81104

82-
@cli.command(help='Rename current branch')
105+
@cli.command(help='Rename current branch.')
83106
@click.argument('name')
84107
def rename(name):
85108
return Igit().rename(name)
@@ -91,7 +114,7 @@ def ignore(reset):
91114
return Igit().ignore(reset)
92115

93116

94-
@cli.command(help='Print igit version')
117+
@cli.command(help='Prints igit version.')
95118
def version():
96119
here = Path(__file__).parent.absolute()
97120
package_conf = {}

igit/interactive/display.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def list(self, text, items, color, icon):
1717
_emoji, _emoji_render_method = self.emojize(icon)
1818
self._display(f'{_emoji} - {text}:', color, _emoji_render_method)
1919
for item in items:
20-
self._display(" * " + item, color, _emoji_render_method)
20+
self._display(" * " + item, 'white', _emoji_render_method)
2121

2222
def emojize(self, icon):
2323
icon = f':{icon}:'

requirements.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
blessed==1.17.6
2+
click==7.1.2
3+
click-help-colors==0.8
4+
emoji==0.6.0
5+
gitdb==4.0.5
6+
gitignore-parser==0.0.8
7+
GitPython==3.1.9
8+
inquirer==2.7.0
9+
invoke==1.4.1
10+
pathlib2==2.3.5
11+
prompt-toolkit==1.0.14
12+
psutil==5.7.2
13+
Pygments==2.7.1
14+
PyInquirer==1.0.3
15+
python-editor==1.0.4
16+
readchar==2.0.1
17+
regex==2020.10.15
18+
six==1.15.0
19+
smmap==3.0.4
20+
termcolor==1.1.0
21+
wcwidth==0.2.5

setup.py

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
import os
21
import setuptools
3-
4-
with open("README.md", "r") as fh:
5-
long_description = fh.read()
2+
from pathlib import Path
3+
import pkg_resources
64

75
package_conf = {}
8-
9-
here = os.path.abspath(os.path.dirname(__file__))
10-
with open(os.path.join(here, "igit", "__version__.py")) as f:
6+
with open(Path("igit") / "__version__.py") as f:
117
exec(f.read(), package_conf)
8+
with open("README.md", "r") as fh:
9+
package_conf['description'] = fh.read()
10+
11+
with Path('requirements.txt').open() as requirements_txt:
12+
install_requires = [
13+
str(requirement)
14+
for requirement
15+
in pkg_resources.parse_requirements(requirements_txt)
16+
]
1217

1318
setuptools.setup(
1419
name="igit",
1520
version=package_conf['__version__'],
16-
author="kobibarhanin",
21+
author="kobi",
1722
author_email="",
1823
description="Interactive git and more",
19-
long_description=long_description,
24+
long_description=package_conf['description'],
2025
long_description_content_type="text/markdown",
2126
url="https://github.com/kobibarhanin/igit",
2227
packages=setuptools.find_packages(),
@@ -30,7 +35,6 @@
3035
"License :: OSI Approved :: MIT License",
3136
"Operating System :: OS Independent",
3237
],
33-
# TODO - remove unnecessary dependencies
34-
install_requires=["astroid==2.4.2" ,"attrs==20.2.0" ,"blessed==1.17.6" ,"click==7.1.2" ,"emoji==0.6.0" ,"fire==0.3.1" ,"gitdb==4.0.5" ,"gitignore-parser==0.0.8" ,"GitPython==3.1.9" ,"importlib-metadata==2.0.0" ,"iniconfig==1.0.1" ,"inquirer==2.7.0" ,"invoke==1.4.1" ,"isort==5.5.4" ,"lazy-object-proxy==1.4.3" ,"mccabe==0.6.1" ,"more-itertools==8.5.0" ,"packaging==20.4" ,"pathlib2==2.3.5" ,"pluggy==0.13.1" ,"prompt-toolkit==1.0.14" ,"psutil==5.7.2" ,"py==1.9.0" ,"Pygments==2.7.1" ,"PyInquirer==1.0.3" ,"pylint==2.6.0" ,"pyparsing==2.4.7" ,"pytest==6.1.0" ,"python-dotenv==0.14.0" ,"python-editor==1.0.4" ,"PyYAML==5.3.1" ,"readchar==2.0.1" ,"regex==2020.9.27" ,"six==1.15.0" ,"smmap==3.0.4" ,"termcolor==1.1.0" ,"toml==0.10.1" ,"typed-ast==1.4.1" ,"wcwidth==0.2.5" ,"wrapt==1.12.1" ,"zipp==3.2.0"],
38+
install_requires=install_requires,
3539
python_requires='>=3.7',
3640
)

0 commit comments

Comments
 (0)