mirror of
https://github.com/Dushistov/sdcv.git
synced 2025-12-19 03:00:51 +00:00
Add option --json-output (-j)
If given -j, format the output of -l and of searches as JSON.
This commit is contained in:
@@ -25,19 +25,22 @@ typedef std::vector<TSearchResult> TSearchResultList;
|
||||
//of it
|
||||
class Library : public Libs {
|
||||
public:
|
||||
Library(bool uinput, bool uoutput, bool colorize_output):
|
||||
utf8_input_(uinput), utf8_output_(uoutput), colorize_output_(colorize_output) {}
|
||||
Library(bool uinput, bool uoutput, bool colorize_output, bool use_json)
|
||||
: utf8_input_(uinput), utf8_output_(uoutput), colorize_output_(colorize_output), json_(use_json) {
|
||||
setVerbose(!use_json);
|
||||
}
|
||||
|
||||
bool process_phrase(const char *loc_str, IReadLine &io, bool force = false);
|
||||
private:
|
||||
bool utf8_input_;
|
||||
bool utf8_output_;
|
||||
bool colorize_output_;
|
||||
bool utf8_output_;
|
||||
bool colorize_output_;
|
||||
bool json_;
|
||||
|
||||
void SimpleLookup(const std::string &str, TSearchResultList& res_list);
|
||||
void LookupWithFuzzy(const std::string &str, TSearchResultList& res_list);
|
||||
void LookupWithRule(const std::string &str, TSearchResultList& res_lsit);
|
||||
void LookupData(const std::string &str, TSearchResultList& res_list);
|
||||
void print_search_result(FILE *out, const TSearchResult & res);
|
||||
void print_search_result(FILE *out, const TSearchResult & res, bool &first_result);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user