p ‐ The command line arguments - binbash23/p GitHub Wiki
You can use p on the command line in scripts as well.
These are the possible command line arguments:
[p] by Jens Heine <[email protected]> version: 2024.03.09
Usage: p.py [options]
Options:
-h, --help show this help message and exit
-a, --add Add new account interactive
-c, --change-database-password
Change database password interactive
-C, --create-add_statements
Create add account statements for all existing
accounts. This is useful if you want to export your
accounts and import them into another p database.
-d DELETE_UUID, --delete=DELETE_UUID
Delete account by UUID. It is usually better to use -i
UUID to invalidate an account.
-D DATABASE, --database=DATABASE
Set database filename. It is also possible to create
an environment variable:
P_DATABASE=<database_filename>
-e EDIT_UUID, --edit=EDIT_UUID
Edit account by UUID
-E, --database-password--empty
Set empty database password
-i INVALIDATE_UUID, --invalidate=INVALIDATE_UUID
Invalidate account by UUID
-I SEARCH_UUID, --search-uuid=SEARCH_UUID
Search account by UUID
-l, --list List all accounts
-p DATABASE_PASSWORD, --database-password=DATABASE_PASSWORD
Set database password. If you want to use an empty
password use -E
-q, --query Query p. Start interactive p shell.
-Q EXECUTE_QUERY, --execute-query=EXECUTE_QUERY
Pass command(s) to the pshell and execute them.
Separate multiple commands with a ';'.
-r REVALIDATE_UUID, --revalidate=REVALIDATE_UUID
Revalidate/activate account by UUID
-s SEARCH_STRING, --search=SEARCH_STRING
Search account. You can also search for an account
like this: p <searchstring>
-S, --statistics Show database statistics
-v, --verbose Show account details (create date, ...)
-V, --version Show p version info
-x, --show_invalidated
Show also invalidated accounts (default=False)
-Z, --start-dropbox-configuration
Start the dropbox configuration. You need the dropbox
application key and the dropbox application secret for
this.
Add new account with arguments (non interactive):
-A, --Add Add a new account non interactive
-L NEW_ACCOUNT_LOGINNAME, --Loginname=NEW_ACCOUNT_LOGINNAME
Set loginname for new account
-N NEW_ACCOUNT_NAME, --Name=NEW_ACCOUNT_NAME
Set name for new account
-P NEW_ACCOUNT_PASSWORD, --Password=NEW_ACCOUNT_PASSWORD
Set password for new account
-T NEW_ACCOUNT_TYPE, --Type=NEW_ACCOUNT_TYPE
Set type for new account
-U NEW_ACCOUNT_URL, --Url=NEW_ACCOUNT_URL
Set url for new account
-X NEW_ACCOUNT_UUID, --UUID=NEW_ACCOUNT_UUID
Set uuid for new account (optional)
If you want to use p in scripts, it is also possible to execute pshell commands. To do this, use the -Q option.
Example:
Let's say your have a p database "p.db" and the password is "ptest" and you want to list all accounts and then exit p automatically:
> ./p -p "ptest" -Q "list;exit"
You set the database password with the "-p" option and a list of pshell commands seperated by ";" with the "-Q" option.