From d821698a546f1d2fd184f04694d57d7ec4522e36 Mon Sep 17 00:00:00 2001 From: Abdulwasiu Apalowo Date: Sat, 5 Nov 2022 23:03:50 +0100 Subject: commandline: Add "_validate" function This patch adds a "_validate" function which validates the CLI argument by parsing the command line to ensure that the required arguments are passed to lcitool Signed-off-by: Abdulwasiu Apalowo --- lcitool/commandline.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lcitool/commandline.py b/lcitool/commandline.py index 50204c3..743401a 100644 --- a/lcitool/commandline.py +++ b/lcitool/commandline.py @@ -4,12 +4,16 @@ # # SPDX-License-Identifier: GPL-2.0-or-later +import sys +import logging import argparse from pathlib import Path from lcitool.application import Application +log = logging.getLogger(__name__) + class CommandLine: @@ -279,5 +283,17 @@ class CommandLine: parents=[manifestopt, dryrunopt, quietopt, basediropt, cidiropt]) manifestparser.set_defaults(func=Application._action_manifest) + # Validate "container" args + def _validate(self, args): + """ + Validate command line arguments. + :param args: argparse.Namespace object which contains + all the CLI arguments. + + :return: args. + """ + + return args + def parse(self): - return self._parser.parse_args() + return self._validate(self._parser.parse_args()) -- cgit v1.1