mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Move fetching quotes info to gnc-commands
It needs gnc-prefs which I don't want to add by default to gnucash-cli.
This commit is contained in:
parent
6ecc1ef73f
commit
5c13da0e59
@ -131,24 +131,7 @@ Gnucash::GnucashCli::start ([[maybe_unused]] int argc, [[maybe_unused]] char **a
|
|||||||
{
|
{
|
||||||
if (*m_quotes_cmd == "info")
|
if (*m_quotes_cmd == "info")
|
||||||
{
|
{
|
||||||
GncQuotes quotes;
|
return Gnucash::quotes_info ();
|
||||||
if (quotes.cmd_result() == 0)
|
|
||||||
{
|
|
||||||
std::cout << bl::format (bl::translate ("Found Finance::Quote version {1}.")) % quotes.version() << "\n";
|
|
||||||
std::cout << bl::translate ("Finance::Quote sources: ");
|
|
||||||
for (auto source : quotes.sources())
|
|
||||||
std::cout << source << " ";
|
|
||||||
std::cout << std::endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cerr << bl::translate ("Finance::Quote isn't "
|
|
||||||
"installed properly.") << "\n";
|
|
||||||
std::cerr << bl::translate ("Error message:") << "\n";
|
|
||||||
std::cerr << quotes.error_msg() << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (*m_quotes_cmd == "get")
|
else if (*m_quotes_cmd == "get")
|
||||||
{
|
{
|
||||||
|
@ -352,6 +352,30 @@ scm_report_list ([[maybe_unused]] void *data,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
Gnucash::quotes_info (void)
|
||||||
|
{
|
||||||
|
gnc_prefs_init ();
|
||||||
|
GncQuotes quotes;
|
||||||
|
if (quotes.cmd_result() == 0)
|
||||||
|
{
|
||||||
|
std::cout << bl::format (bl::translate ("Found Finance::Quote version {1}.")) % quotes.version() << "\n";
|
||||||
|
std::cout << bl::translate ("Finance::Quote sources: ");
|
||||||
|
for (auto source : quotes.sources())
|
||||||
|
std::cout << source << " ";
|
||||||
|
std::cout << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << bl::translate ("Finance::Quote isn't "
|
||||||
|
"installed properly.") << "\n";
|
||||||
|
std::cerr << bl::translate ("Error message:") << "\n";
|
||||||
|
std::cerr << quotes.error_msg() << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Gnucash::add_quotes (const bo_str& uri)
|
Gnucash::add_quotes (const bo_str& uri)
|
||||||
{
|
{
|
||||||
|
@ -32,6 +32,7 @@ using bo_str = boost::optional <std::string>;
|
|||||||
|
|
||||||
namespace Gnucash {
|
namespace Gnucash {
|
||||||
|
|
||||||
|
int quotes_info (void);
|
||||||
int add_quotes (const bo_str& uri);
|
int add_quotes (const bo_str& uri);
|
||||||
int run_report (const bo_str& file_to_load,
|
int run_report (const bo_str& file_to_load,
|
||||||
const bo_str& run_report,
|
const bo_str& run_report,
|
||||||
|
Loading…
Reference in New Issue
Block a user