54 lines
1.7 KiB
Python
Executable File
54 lines
1.7 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
#############################################################################
|
|
# Copyright (c) 2019-2021 University of Exeter, UK
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#############################################################################
|
|
|
|
"""
|
|
Onboarding and offboarding of suppliers.
|
|
"""
|
|
import sys
|
|
|
|
import argparse
|
|
import logging
|
|
|
|
from pplca.onboarding import createInitialFolders, joinSupplyChain
|
|
from pplca.config import const_log_format
|
|
|
|
if __name__ == "__main__":
|
|
|
|
logging.getLogger("requests").setLevel(logging.WARNING)
|
|
logger = logging.getLogger()
|
|
ch = logging.StreamHandler(sys.stdout)
|
|
ch.setFormatter(logging.Formatter(const_log_format("boarding.py")))
|
|
logger.addHandler(ch)
|
|
|
|
p = argparse.ArgumentParser()
|
|
subparsers = p.add_subparsers()
|
|
|
|
option1_parser = subparsers.add_parser(
|
|
"setInitialSteps", help="Create main folders"
|
|
)
|
|
option1_parser.set_defaults(func=createInitialFolders)
|
|
|
|
option2_parser = subparsers.add_parser(
|
|
"joinSupplyChain", help="Joining Supply Chain"
|
|
)
|
|
option2_parser.set_defaults(func=joinSupplyChain)
|
|
|
|
args = p.parse_args()
|
|
args.func(args)
|