cli: Extract layout argument parsing into cli_common

Move the parsing logic for layout sources into the new function
cli_parse_layout_args(). This way it can be shared with other CLIs.

Signed-off-by: Nico Huber <nico.h@gmx.de>

Change-Id: Idcbb136d31477cdb0aebec4af0c4cbc873f26011
diff --git a/include/cli.h b/include/cli.h
index fb55191..b243f1d 100644
--- a/include/cli.h
+++ b/include/cli.h
@@ -18,6 +18,7 @@
 enum {
 	OPTION_CHIP = 'c',
 	OPTION_PROGRAMMER = 'p',
+	OPTION_LAYOUT = 'l',
 
 	/* Options below have only long option names, i.e. no single char: */
 	OPTION_IFD = 0x0100,
@@ -35,6 +36,16 @@
 	char *prog_args;
 };
 
+struct layout_args {
+	bool ifd;
+	bool fmap;
+	char *fmapfile;
+	char *layoutfile;
+};
+
+int cli_check_filename(const char *filename, const char *type);
+
 int cli_parse_flash_args(struct flash_args *, int opt, const char *optarg);
+int cli_parse_layout_args(struct layout_args *, int opt, const char *optarg);
 
 #endif