File tree Expand file tree Collapse file tree 4 files changed +24
-6
lines changed Expand file tree Collapse file tree 4 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 3636from tools .build_api import static_analysis_scan , static_analysis_scan_lib , static_analysis_scan_library
3737from tools .build_api import print_build_results
3838from tools .settings import CPPCHECK_CMD , CPPCHECK_MSG_FORMAT
39- from utils import argparse_filestring_type
39+ from utils import argparse_filestring_type , args_error
4040from tools .settings import CPPCHECK_CMD , CPPCHECK_MSG_FORMAT , CLI_COLOR_MAP
4141from utils import argparse_filestring_type , argparse_dir_not_parent
4242
167167 # Get toolchains list
168168 toolchains = options .tool if options .tool else TOOLCHAINS
169169
170+ if options .source_dir and not options .build_dir :
171+ args_error (parser , "argument --build is required by argument --source" )
172+
170173 if options .color :
171174 # This import happens late to prevent initializing colorization when we don't need it
172175 import colorize
Original file line number Diff line number Diff line change 212212
213213 # Toolchain
214214 if options .tool is None :
215- args_error (parser , "argument -t/--toolchain is required" )
215+ args_error (parser , "argument -t/--tool is required" )
216216 toolchain = options .tool [0 ]
217217
218+ if (options .program is None ) and (not options .source_dir ):
219+ args_error (parser , "one of -p, -n, or --source is required" )
220+
221+ if options .source_dir and not options .build_dir :
222+ args_error (parser , "argument --build is required when argument --source is provided" )
223+
218224 if options .color :
219225 # This import happens late to prevent initializing colorization when we don't need it
220226 import colorize
Original file line number Diff line number Diff line change 1313from tools .tests import test_known , test_name_known
1414from tools .targets import TARGET_NAMES
1515from tools .libraries import LIBRARIES
16- from utils import argparse_filestring_type , argparse_many
16+ from utils import argparse_filestring_type , argparse_many , args_error
1717from utils import argparse_force_lowercase_type , argparse_force_uppercase_type , argparse_dir_not_parent
1818from project_api import setup_project , perform_export , print_results , get_lib_symbols
1919
131131
132132 # source_dir = use relative paths, otherwise sources are copied
133133 sources_relative = True if options .source_dir else False
134+ # Target
135+ if not options .mcu :
136+ args_error (parser , "argument -m/--mcu is required" )
137+
138+ # Toolchain
139+ if not options .ide :
140+ args_error (parser , "argument -i is required" )
141+
142+ if (options .program is None ) and (not options .source_dir ):
143+ args_error (parser , "one of -p, -n, or --source is required" )
134144
135145 for mcu in options .mcu :
136146 # Program Number or name
Original file line number Diff line number Diff line change 112112
113113 # Toolchain
114114 if options .tool is None :
115- args_error (parser , "argument -t/--toolchain is required" )
115+ args_error (parser , "argument -t/--tool is required" )
116116 toolchain = options .tool [0 ]
117117
118118 # Find all tests in the relevant paths
152152 else :
153153 # Build all tests
154154 if not options .build_dir :
155- print "[ERROR] You must specify a build path"
156- sys .exit (1 )
155+ args_error (parser , "argument --build is required" )
157156
158157 base_source_paths = options .source_dir
159158
You can’t perform that action at this time.
0 commit comments