Tested on macOS 10.13
Add a password to the default keychain:
$ security add-generic-password -a ${USER} -s NAME -w
Retrieve the password:
$ security find-generic-password -a ${USER} -s NAME -w
Delete the password:
$ security delete-generic-password -a ${USER} -s NAME