diff options
Diffstat (limited to 'src/output.cc')
-rw-r--r-- | src/output.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/output.cc b/src/output.cc index 7f0d4d1..9661cbe 100644 --- a/src/output.cc +++ b/src/output.cc @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2017 by Hans-Peter Deifel * + * Copyright (C) 2011-2018 by Hans-Peter Deifel * * hpd@hpdeifel.de * * * * This program is free software; you can redistribute it and/or modify * @@ -87,6 +87,17 @@ std::ostream& line_prefix(const Outconf& outconf, const std::string& filename, return cout; } +void print_only_filename(const Outconf& outconf, const std::string& filename) { + with_color(outconf.color, outconf.colors.filename, + cout << filename;); + + if (outconf.null_byte_sep) { + cout << '\0'; + } else { + cout << endl; + } +} + std::ostream& line_prefix(const Outconf& outconf, const std::string& filename, bool in_context) { if (outconf.filename) { @@ -106,6 +117,7 @@ std::ostream& line_prefix(const Outconf& outconf, const std::string& filename, return cout; } + // Invariant: matches can't be empty void print_matches(const context& context, const std::vector<match>& matches) { const match& first_match = matches.front(); |