aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdulwasiu Apalowo <abdulwasiuapalowo@gmail.com>2022-11-05 23:03:50 +0100
committerAbdulwasiu Apalowo <abdulwasiuapalowo@gmail.com>2023-01-10 14:00:11 +0100
commitd821698a546f1d2fd184f04694d57d7ec4522e36 (patch)
tree003daaefe5a5ffbf91bd169cc8539b16e7930122
parent116675906c098a31e946bbfe06f4b93da5753f28 (diff)
downloadlibvirt-ci-d821698a546f1d2fd184f04694d57d7ec4522e36.zip
libvirt-ci-d821698a546f1d2fd184f04694d57d7ec4522e36.tar.gz
libvirt-ci-d821698a546f1d2fd184f04694d57d7ec4522e36.tar.bz2
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 <abdulwasiuapalowo@gmail.com>
-rw-r--r--lcitool/commandline.py18
1 files changed, 17 insertions, 1 deletions
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())