Code cleanup

This commit is contained in:
Quentin Snow 2023-01-27 19:06:19 -06:00
parent 5a88299f9e
commit 2c3436ee94
3 changed files with 43 additions and 42 deletions

View File

@ -293,40 +293,39 @@ void MainOptHandler::paymentOptHandler(std::string account) {
}
void MainOptHandler::help() {
std::cout << "Output of budget." << std::endl;
std::cout << "Usage:" << std::endl;
std::cout << "\tbudget <action> [options] ..." << std::endl;
std::cout << "Actions:" << std::endl;
std::cout << "\t-h --help Prints this." << std::endl;
std::cout << "\t-a --account<=STRING> Management tools for an account." << std::endl;
std::cout << "\t-c --create<=STRING> Creates a new account with NAME." << std::endl;
std::cout << "\t-e --earn<=STRING> Add an earning to an account." << std::endl;
std::cout << "\t-p --payment<=STRING> Add a payment to an account." << std::endl;
std::cout << "Account Options: [-dvD]" << std::endl;
std::cout << "\t-d --delete Deletes specified account." << std::endl;
std::cout << "\t--force-delete Deletes the specified account without confirmation." << std::endl;
std::cout << "\t-v --value Gets the current value of the account." << std::endl;
std::cout << "\t-D --description<=STRING> Changes the description of the account." << std::endl;
std::cout << "Create Options: [-d]" << std::endl;
std::cout << "\t-d --description<=STRING> Sets a description for an account." << std::endl;
std::cout << "Earn Options: -v [-drD]" << std::endl;
std::cout << "\t-v --value=<FlOAT> Value for earning." << std::endl;
std::cout << "\t-d --description=<STRING> Description for earning." << std::endl;
std::cout << "\t-r --receipt=<PATH> Path to file to store in DB as receipt." << std::endl;
std::cout << "\t-D --date=<mm/dd/yyyyTHH:MM:SS> Date as dd/mm/yyyyTHH:MM:SS. Default will be today." << std::endl;
std::cout << "Payment Options: -v [-drD]" << std::endl;
std::cout << "\t-v --value=<FlOAT> Value for payment." << std::endl;
std::cout << "\t-d --description=<STRING> Description for payment." << std::endl;
std::cout << "\t-r --receipt=<PATH> Path to file to store in DB as receipt." << std::endl;
std::cout << "\t-D --date=<mm/dd/yyyyTHH:MM:SS> Date as dd/mm/yyyyTHH:MM:SS. Default will be today." << std::endl;
std::cout << std::endl;
std::cout << "Arguments are processed like blocks with each one terminated by the next Action. For example"
<< std::endl;
std::cout << std::endl;
std::cout << R"(budget -cAcct -eAcct -v10.00 -r"./receipt.pdf" -pAcct -v5.50 -r"./payment.pdf")" << std::endl;
std::cout << std::endl;
std::cout << "Does the following in order:" << std::endl;
std::cout << "Creates an account named Acct with no description." << std::endl;
std::cout << "Earns 10.00 to it with a receipt." << std::endl;
std::cout << "Pays 5.50 to it with a receipt." << std::endl;
std::cout << "Output of budget.\n"
"Usage:\n"
" budget <action> [options] ...\n"
"Actions:\n"
" -h --help Prints this.\n"
" -a --account<=STRING> Management tools for an account.\n"
" -c --create<=STRING> Creates a new account with NAME.\n"
" -e --earn<=STRING> Add an earning to an account.\n"
" -p --payment<=STRING> Add a payment to an account.\n"
"Account Options: [-dvD]\n"
" -d --delete Deletes specified account.\n"
" --force-delete Deletes the specified account without confirmation.\n"
" -v --value Gets the current value of the account.\n"
" -D --description<=STRING> Changes the description of the account.\n"
"Create Options: [-d]\n"
" -d --description<=STRING> Sets a description for an account.\n"
"Earn Options: -v [-drD]\n"
" -v --value=<FlOAT> Value for earning.\n"
" -d --description=<STRING> Description for earning.\n"
" -r --receipt=<PATH> Path to file to store in DB as receipt.\n"
" -D --date=<mm/dd/yyyyTHH:MM:SS> Date as dd/mm/yyyyTHH:MM:SS. Default will be today.\n"
"Payment Options: -v [-drD]\n"
" -v --value=<FlOAT> Value for payment.\n"
" -d --description=<STRING> Description for payment.\n"
" -r --receipt=<PATH> Path to file to store in DB as receipt.\n"
" -D --date=<mm/dd/yyyyTHH:MM:SS> Date as dd/mm/yyyyTHH:MM:SS. Default will be today.\n"
"\n"
"Arguments are processed like blocks with each one terminated by the next Action. For example\n"
"\n"
"budget -cAcct -eAcct -v10.00 -r\"./receipt.pdf\" -pAcct -v5.50 -r\"./payment.pdf\"\n"
"\n"
"Does the following in order:\n"
"Creates an account named Acct with no description.\n"
"Earns 10.00 to it with a receipt.\n"
"Pays 5.50 to it with a receipt." << std::endl;
}

View File

@ -14,9 +14,11 @@ public:
~SqliteDb() {
sqlite3_close(m_db);
}
explicit operator sqlite3 *() {
return m_db;
}
private:
sqlite3 *m_db;
};