wp config create writes a complete wp-config.php, salts included. The usual example puts the database password right on the command line, which I’d rather avoid.
wp config create --dbname=example_wp --dbuser=example --prompt=dbpass
--prompt=dbpass asks for that one value interactively, so it does not end up in ~/.bash_history or in the process list. In a script you can feed it from a file instead, as the docs show:
wp config create --dbname=example_wp --dbuser=example --prompt=dbpass < password.txt
Other options: --dbhost (default localhost), --dbprefix (default wp_) and --locale. --extra-php reads more PHP from standard input and puts it in the file, handy for WP_DEBUG or WP_ENVIRONMENT_TYPE lines.
By default it connects to the database first and stops when the credentials are wrong, which I appreciate, because a typo shows up right away. --skip-check turns it off, for example when the database server isn’t up yet in a container setup. It won’t overwrite an existing wp-config.php unless you pass --force, and with --force you also get new salts, which logs everyone out.
Further reading: wp config create