Fix platform check to work with optional command-line arguments

Fix platform check to work with optional command-line arguments

deploy command has the target platform as an optional argument. Fix platform checks to behave properly when it is missing.

fixes #271557