Skip to content

Commit 1734314

Browse files
Merge pull request #5 from GrbavaCigla/dev
Added __main__.py and it's entry
2 parents 9529626 + b14566d commit 1734314

File tree

3 files changed

+63
-22
lines changed

3 files changed

+63
-22
lines changed

README.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ default is 1
2020
change the num value according to your needs.
2121
2222
'''
23-
# For First Name
23+
# For first name
2424
rp.first_name()
2525

26-
# For First Name
26+
# For full name
2727
rp.full_name()
2828

29-
# For First Name
29+
# For full profile
3030
rp.full_profile()
31+
32+
# For last name
33+
rp.last_name()
3134
```
3235

3336
## Installation
@@ -42,7 +45,7 @@ conda install random-profile # on anacoda
4245

4346
## Usage
4447

45-
random-profile module is a random profile generator for many usages ex- fake dataset,youtube videos, content creation, personal projects.
48+
random-profile module is a random profile generator for many usages ex- fake dataset, youtube videos, content creation, personal projects.
4649

4750
## Support
4851

random_profile/__main__.py

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
from .main import RandomProfile
2+
import argparse
3+
4+
5+
def main():
6+
parser = argparse.ArgumentParser()
7+
parser.add_argument("-n", help="Number of random profiles", type=int, default=1)
8+
9+
group = parser.add_mutually_exclusive_group()
10+
group.add_argument(
11+
"-f",
12+
"--fullname",
13+
help="Get full name instead of first name",
14+
action="store_true",
15+
)
16+
group.add_argument(
17+
"-p",
18+
"--profile",
19+
help="Get full profile instead of first name",
20+
action="store_true",
21+
)
22+
group.add_argument(
23+
"-l",
24+
"--lastname",
25+
help="Get last name instead of first name",
26+
action="store_true",
27+
)
28+
29+
args = parser.parse_args()
30+
31+
rp = RandomProfile(args.n)
32+
if args.fullname:
33+
print(*rp.full_name(), sep="\n")
34+
elif args.profile:
35+
print(*rp.full_profile(), sep="\n")
36+
elif args.lastname:
37+
print(*rp.last_name(), sep="\n")
38+
else:
39+
print(*rp.first_name())
40+
41+
42+
if __name__ == "__main__":
43+
main()

setup.py

+13-18
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,32 @@
11
import setuptools
2-
2+
33
with open("README.md", "r") as fh:
44
long_description = fh.read()
5-
5+
66
setuptools.setup(
7-
#Here is the module name.
7+
# Here is the module name.
88
name="random_profile",
9-
10-
#version of the module
9+
# version of the module
1110
version="0.1.0",
12-
13-
#Name of Author
11+
# Name of Author
1412
author="CodePerfectPlus",
15-
16-
#your Email address
13+
# your Email address
1714
author_email="[email protected]",
18-
19-
#Small Description about module
15+
# Small Description about module
2016
description="Generate Random Profile",
21-
2217
long_description=long_description,
23-
24-
#Specifying that we are using markdown file for description
18+
# Specifying that we are using markdown file for description
2519
long_description_content_type="text/markdown",
26-
27-
#Any link to reach this module, if you have any webpage or github profile
20+
# Any link to reach this module, if you have any webpage or github profile
2821
url="https://github.com/codePerfectPlus/Random-Profile-Generator",
2922
packages=setuptools.find_packages(),
30-
31-
#classifiers like program is suitable for python3, just leave as it is.
23+
# classifiers like program is suitable for python3, just leave as it is.
3224
classifiers=[
3325
"Programming Language :: Python :: 3",
3426
"License :: OSI Approved :: MIT License",
3527
"Operating System :: OS Independent",
3628
],
29+
entry_points={
30+
"console_scripts": ["random_profile = random_profile.__main__:main"],
31+
},
3732
)

0 commit comments

Comments
 (0)