PARSER.add_argument("-r", dest="port_to_remove", help="Remove port")

    PARSER.add_argument(
        "-g",
        dest="generate_database",
        action="store_true",
        help="Generate database from configuration files in current folder",
    )

    PARSER.add_argument("-p", dest="oprp_config_file_path", help="Path to where the oprp config files are located")

    PARSER.add_argument(dest="database")
    ARGS = PARSER.parse_args()

    DATABASE = PortDatabase(ARGS.database)

    if ARGS.port_to_remove:
        DATABASE.remove_row(ARGS.port_to_remove)

    if ARGS.oprp_config_file_path:
        CONFIG_EDITOR = PortDatabaseEditor(ARGS.oprp_config_file_path)
    else:
        CONFIG_EDITOR = PortDatabaseEditor()

    if ARGS.generate_database:
        CONFIG_EDITOR.extract_database_info_from_config_file(DATABASE)

    if ARGS.show_database_content:
        DATABASE.print_table()
Beispiel #2
0
    PARSER.add_argument('-r', dest='port_to_remove', help="Remove port")

    PARSER.add_argument(
        '-g',
        dest='generate_database',
        action='store_true',
        help="Generate database from configuration files in current folder")

    PARSER.add_argument('-p',
                        dest='oprp_config_file_path',
                        help="Path to where the oprp config files are located")

    PARSER.add_argument(dest="database")
    ARGS = PARSER.parse_args()

    DATABASE = PortDatabase(ARGS.database)

    if ARGS.port_to_remove:
        DATABASE.remove_row(ARGS.port_to_remove)

    if ARGS.oprp_config_file_path:
        CONFIG_EDITOR = PortDatabaseEditor(ARGS.oprp_config_file_path)
    else:
        CONFIG_EDITOR = PortDatabaseEditor()

    if ARGS.generate_database:
        CONFIG_EDITOR.extract_database_info_from_config_file(DATABASE)

    if ARGS.show_database_content:
        DATABASE.print_table()