This commit is contained in:
parent
bf29df39e9
commit
c631e5c4fe
|
@ -2,7 +2,7 @@
|
||||||
:doctype: manpage
|
:doctype: manpage
|
||||||
:Author: tastytea
|
:Author: tastytea
|
||||||
:Email: tastytea@tastytea.de
|
:Email: tastytea@tastytea.de
|
||||||
:Date: 2019-12-20
|
:Date: 2019-12-24
|
||||||
:Revision: 0.0.0
|
:Revision: 0.0.0
|
||||||
:man source: mastorss
|
:man source: mastorss
|
||||||
:man manual: General Commands Manual
|
:man manual: General Commands Manual
|
||||||
|
@ -71,6 +71,18 @@ Example: `http_proxy="http://localhost:3128/" mastorss`
|
||||||
| 9 | Unknown error.
|
| 9 | Unknown error.
|
||||||
|===========================================================
|
|===========================================================
|
||||||
|
|
||||||
|
== DEBUGGING
|
||||||
|
|
||||||
|
Define the variable `MASTORSS_DEBUG` to enable debug output.
|
||||||
|
|
||||||
|
.Debug mastorss while using the profile “example”.
|
||||||
|
================================================================================
|
||||||
|
[source,shell]
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
MASTORSS_DEBUG=1 mastorss example
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
================================================================================
|
||||||
|
|
||||||
== SEE ALSO
|
== SEE ALSO
|
||||||
|
|
||||||
*curl*(1), *crontab*(1), *crontab*(5)
|
*curl*(1), *crontab*(1), *crontab*(5)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
# The minimum versions should be in Debian oldstable, if possible.
|
# The minimum versions should be in Debian oldstable, if possible.
|
||||||
find_package(Boost 1.62 REQUIRED COMPONENTS system filesystem)
|
find_package(Boost 1.62 REQUIRED COMPONENTS system filesystem log)
|
||||||
find_package(jsoncpp 1.7 REQUIRED CONFIG)
|
find_package(jsoncpp 1.7 REQUIRED CONFIG)
|
||||||
find_package(CURL 7.52 REQUIRED)
|
find_package(CURL 7.52 REQUIRED)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
@ -18,7 +18,12 @@ include_directories("${PROJECT_BINARY_DIR}")
|
||||||
file(GLOB sources *.cpp)
|
file(GLOB sources *.cpp)
|
||||||
add_executable(mastorss ${sources})
|
add_executable(mastorss ${sources})
|
||||||
target_link_libraries(mastorss
|
target_link_libraries(mastorss
|
||||||
mastodon-cpp::mastodon-cpp Boost::system Boost::filesystem restclient-cpp)
|
PRIVATE
|
||||||
|
jsoncpp restclient-cpp mastodon-cpp::mastodon-cpp
|
||||||
|
Boost::filesystem Boost::log)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
target_compile_definitions(mastorss PRIVATE "BOOST_ALL_DYN_LINK=1")
|
||||||
|
endif()
|
||||||
install(TARGETS mastorss DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
install(TARGETS mastorss DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
|
|
||||||
install(FILES watchwords.json
|
install(FILES watchwords.json
|
||||||
|
|
|
@ -18,13 +18,15 @@
|
||||||
#include "exceptions.hpp"
|
#include "exceptions.hpp"
|
||||||
#include "version.hpp"
|
#include "version.hpp"
|
||||||
|
|
||||||
|
#include <boost/log/trivial.hpp>
|
||||||
#include <restclient-cpp/connection.h>
|
#include <restclient-cpp/connection.h>
|
||||||
#include <restclient-cpp/restclient.h>
|
#include <restclient-cpp/restclient.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
using namespace mastorss;
|
namespace mastorss
|
||||||
|
{
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::move;
|
using std::move;
|
||||||
|
|
||||||
|
@ -54,6 +56,7 @@ void Document::download()
|
||||||
case 200:
|
case 200:
|
||||||
{
|
{
|
||||||
_raw_doc = response.body;
|
_raw_doc = response.body;
|
||||||
|
BOOST_LOG_TRIVIAL(debug) << "Downloaded feed: " << _uri;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 301:
|
case 301:
|
||||||
|
@ -73,3 +76,4 @@ void Document::download()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} // namespace mastorss
|
||||||
|
|
21
src/main.cpp
21
src/main.cpp
|
@ -3,13 +3,21 @@
|
||||||
#include "exceptions.hpp"
|
#include "exceptions.hpp"
|
||||||
#include "version.hpp"
|
#include "version.hpp"
|
||||||
|
|
||||||
|
#include <boost/log/core.hpp>
|
||||||
|
#include <boost/log/trivial.hpp>
|
||||||
|
#include <boost/log/utility/setup/console.hpp>
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <stdexcept>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using namespace mastorss;
|
using namespace mastorss;
|
||||||
|
using std::getenv;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
|
using std::runtime_error;
|
||||||
using std::string_view;
|
using std::string_view;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
|
@ -40,7 +48,7 @@ void print_version()
|
||||||
|
|
||||||
void print_help(const string_view &command)
|
void print_help(const string_view &command)
|
||||||
{
|
{
|
||||||
cerr << "Usage: " << command << " [--version] <profile>\n";
|
cerr << "Usage: " << command << " [--version|--help] <profile>\n";
|
||||||
}
|
}
|
||||||
} // namespace mastorss
|
} // namespace mastorss
|
||||||
|
|
||||||
|
@ -48,6 +56,17 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
const vector<string_view> args(argv, argv + argc);
|
const vector<string_view> args(argv, argv + argc);
|
||||||
|
|
||||||
|
if (getenv("MASTORSS_DEBUG") == nullptr)
|
||||||
|
{
|
||||||
|
boost::log::core::get()->set_filter
|
||||||
|
(boost::log::trivial::severity >= boost::log::trivial::info);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
boost::log::core::get()->set_filter
|
||||||
|
(boost::log::trivial::severity >= boost::log::trivial::debug);
|
||||||
|
}
|
||||||
|
|
||||||
if (args.size() == 1)
|
if (args.size() == 1)
|
||||||
{
|
{
|
||||||
print_help(args[0]);
|
print_help(args[0]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user