Skip to content

Commit 49f9511

Browse files
Fix 'pip install'
1 parent 3a44175 commit 49f9511

4 files changed

Lines changed: 42 additions & 4 deletions

File tree

gitprof/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@
1919
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE.
22-
__version__ = "1.0.0"
22+
import os
2323

2424
from gitprof.cli import root
2525

26+
__version__ = "1.0.0"
27+
28+
29+
def get_version_message():
30+
return f"GitProf v{__version__} is installed at '{os.path.dirname(os.path.abspath(__file__))}'"
31+
2632

2733
def init():
2834
"""

gitprof/cli/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE.
2222
import click
23+
import gitprof
2324

2425

2526
@click.group()
2627
def root():
2728
pass
2829

2930

31+
@root.command("version", help="Show GitProf version")
32+
def version():
33+
print(gitprof.get_version_message())
34+
35+
3036
from gitprof.cli.clone import clone
3137
from gitprof.cli.profile import profile
3238
from gitprof.cli.config import config

gitprof/cli/profile.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,17 @@ def profile():
4040

4141

4242
@profile.command("create", help="Add a new profile")
43-
@click.argument("name")
43+
@click.argument("name", required=False)
4444
@click.option("--username", help="Your username for the service (e.g. GitHub)")
4545
def create_profile(name: str, username: str = None):
46-
ux.print_header(f"Creating profile: {name}")
46+
name = name or ux.get_simple_input(
47+
question="Enter a name for your profile (e.g. 'github')",
48+
validator=lambda i: i,
49+
)
4750

51+
ux.print_header(f"Creating profile: {name}")
4852
config = Config()
53+
4954
if config.get_profile(name):
5055
click.echo(
5156
f"Profile '{name}' already exists. Please edit it instead of creating a new one.",
@@ -128,7 +133,7 @@ def create_profile(name: str, username: str = None):
128133
config.add_profile(profile)
129134
config.save()
130135

131-
click.echo(f"Saved profile: {name}")
136+
click.echo(f"Saved profile: {profile.name}")
132137

133138

134139
@profile.command("apply", help="Apply profile to current repository")

gitprof/vcs/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2020 Sam McCormack
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.

0 commit comments

Comments
 (0)