FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
robust-python-demo/scripts/setup-git.py at main · robust-python/robust-python-demo · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
robust-python
/
robust-python-demo
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
10
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
robust-python-demo
/
scripts
/
setup-git.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
53 lines (41 loc) · 1.61 KB
Breadcrumbs
robust-python-demo
/
scripts
/
setup-git.py
Copy path
File metadata and controls
53 lines (41 loc) · 1.61 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""Script responsible for first time setup of the project's git repo.
Since this is a first time setup script, we intentionally only use builtin Python dependencies.
"""
import
argparse
import
subprocess
from
pathlib
import
Path
from
util
import
check_dependencies
from
util
import
existing_dir
def
main
()
->
None
:
"""Parses command line input and passes it through to setup_git."""
parser
:
argparse
.
ArgumentParser
=
get_parser
()
args
:
argparse
.
Namespace
=
parser
.
parse_args
()
setup_git
(
path
=
args
.
path
)
def
setup_git
(
path
:
Path
)
->
None
:
"""Set up the provided cookiecutter-robust-python project's git repo."""
commands
:
list
[
list
[
str
]]
=
[
[
"git"
,
"init"
],
[
"git"
,
"branch"
,
"-m"
,
"master"
,
"main"
],
[
"git"
,
"add"
,
"."
],
[
"git"
,
"commit"
,
"-m"
,
"feat: initial commit"
],
[
"git"
,
"checkout"
,
"-b"
,
"develop"
,
"main"
],
]
check_dependencies
(
path
=
path
,
dependencies
=
[
"git"
])
for
command
in
commands
:
subprocess
.
run
(
command
,
cwd
=
path
,
stderr
=
subprocess
.
STDOUT
)
def
get_parser
()
->
argparse
.
ArgumentParser
:
"""Creates the argument parser for setup-git."""
parser
:
argparse
.
ArgumentParser
=
argparse
.
ArgumentParser
(
prog
=
"setup-git"
,
usage
=
"python ./scripts/setup-git.py . -u robust-python -n robust-python-demo"
,
description
=
"Set up the provided cookiecutter-robust-python project's git repo."
,
)
parser
.
add_argument
(
"path"
,
type
=
existing_dir
,
metavar
=
"PATH"
,
help
=
"Path to the repo's root directory (must already exist)."
,
)
return
parser
if
__name__
==
"__main__"
:
main
()
Back
|
FazBrowse Home
|
New Git URL