Give option to specify working directory (totally useless but too late now)
This commit is contained in:
parent
c43fee7024
commit
782729ee58
13
main.py
13
main.py
@ -4,6 +4,7 @@ from domain.Migrator import Migrator
|
|||||||
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -12,6 +13,14 @@ def main():
|
|||||||
prog="Mike's Gitea Repo Migrator - Move repositories from one Gitea instance to another"
|
prog="Mike's Gitea Repo Migrator - Move repositories from one Gitea instance to another"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--cwd", "--working-directory",
|
||||||
|
dest="working_directory",
|
||||||
|
required=False,
|
||||||
|
default=None,
|
||||||
|
help="Specify the working directory"
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--source-hostname", "--source-host",
|
"--source-hostname", "--source-host",
|
||||||
dest="source_hostname",
|
dest="source_hostname",
|
||||||
@ -132,6 +141,10 @@ def main():
|
|||||||
)
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if args.working_directory is not None:
|
||||||
|
os.chdir(args.working_directory)
|
||||||
|
|
||||||
mig = Migrator(
|
mig = Migrator(
|
||||||
source_host=args.source_hostname,
|
source_host=args.source_hostname,
|
||||||
source_port=args.source_port,
|
source_port=args.source_port,
|
||||||
|
Loading…
Reference in New Issue
Block a user