nmcli device wifi connect code example
Example: nmcli connect wifi
# see available connections
nmcli d wifi
# disconnect from the access point you are currently connected to
# replace <current AP> with the AP you are currently connected to
nmcli c down <current AP> # see previous command output
# connect to new AP
# replace <AP name> with name of AP you want to connect to
# replace <password> with the password of the AP
nmcli d wifi c <AP name> password <password>
# hope this helped you :)