You can only use something like this:
openssl -extensions mysection -config myconfig.cnf
and myconfig.cnf:
[mysection]
keyUsage = digitalSignature
extendedKeyUsage = codeSigning
I am not aware of command line interface to this functionality.