Commit 828c7055 authored by FulcrandG's avatar FulcrandG
Browse files

Adding argparse to all tool scripts

parent b05f0712
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -363,6 +363,17 @@ def add_placeholder():
                template = env.get_template(utils.TEMPLATE_PLACEHOLDER)
                file_handle.write(template.render())

def argparse_setup():
    """Setup argparse

    Return
    ------
    obj
        Python object with arguments parsed
    """
    parser = argparse.ArgumentParser()
    return parser.parse_args()

def main():
    """
    Main function, multiple-purpose:
@@ -372,8 +383,12 @@ def main():
    - Create jobs index
    """

    # Setup argparse
    args = argparse_setup()

    # logging
    logging.basicConfig(level=logging.INFO)
    
    # Iterate over every directories in jobs directory to create their job.md for the documentation
    jobs = listdir(utils.JOBS_DIR)
    for job in jobs:
+14 −2
Original line number Diff line number Diff line
@@ -13,8 +13,6 @@ import requests
from tools.utils.utils import Config
utils = Config()



def get_labels(project_name, with_counts=False, include_ancestor_groups=True, search=""):
    """Get labels of the project, can also serach for a specific label with search filter

@@ -99,6 +97,17 @@ def delete_label(project_name, label_name):
    logging.info(f"Deleting a label {label_name} for the project {project_name}")
    return (requests.delete(url, headers=headers))

def argparse_setup():
    """Setup argparse

    Return
    ------
    obj
        Python object with arguments parsed
    """
    parser = argparse.ArgumentParser()
    return parser.parse_args()

if __name__ == "__main__":
    """Main function if used as a program
    Looping through all jobs to check if their scoped
@@ -109,6 +118,9 @@ if __name__ == "__main__":
    boolean
        0 if nothing is wrong, 1 otherwise
    """
    # Setup argparse
    args = argparse_setup()

    # Setup logging
    logging.basicConfig(
        encoding="utf-8",