You have a couple of options.
One option is to have a running wallet RPC: monero-wallet-rpc --wallet-dir . --rpc-bind-port 18085 --disable-rpc-login
Which you can then call its create_wallet method like:
curl -X POST http://localhost:18085/json_rpc -d \
'{"jsonrpc":"2.0","id":"0","method":"create_wallet","params":\
{"filename":"monerowallet","password":"pass","language":"English"}}' \
-H 'Content-Type: application/json'
Another option would be to use monero-wallet-cli --generate-from-json wallet.json
when you have a wallet.json
with content like:
{
"version": 1,
"filename": "monerowallet",
"scan_from_height": 1796000,
"password": "pass",
"seed": "some valid seed ..."
}
But of course that requires you to have already created a seed.
Lastly, another approach I've seen used is to create a wrapper script around monero-wallet-cli --generate-new-wallet
which uses redirection to echo input to the monero-wallet-cli
processes stdin. There are many ways to accomplish this and is very much shell specific.
The RPC method is probably your best option (without knowing your use-case).
--generate-from-json
doesn't prompt for input if all the required parameters are in the json file. Also, you don't need to pre-generate any keys, just a seed. See my answer.