Skip to content

Commit 463b2ce

Browse files
src/FalcoConfig.hcpp and src/falco.cpp: require a flag to report progress bar while running; this is to prevent CR chars unless the user wants it
1 parent bf220c4 commit 463b2ce

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/FalcoConfig.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ FalcoConfig::FalcoConfig(const int argc, char *argv[]) {
329329

330330

331331
quiet = false;
332+
progress = false;
332333
tmpdir = ".";
333334

334335
is_sam = false;

src/FalcoConfig.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2019-2022 Guilherme De Sena Brandine and
1+
/* Copyright (C) 2019-2026 Guilherme De Sena Brandine and
22
* Andrew D. Smith
33
* Authors: Guilherme De Sena Brandine, Andrew Smith
44
*
@@ -42,7 +42,7 @@ struct FalcoConfig {
4242
bool extract; // if set the zipped file will be uncompressed
4343
bool nogroup; // disable grouping of bases for reads >50bp
4444
bool compressed; // whether or not to inflate file
45-
bool quiet;
45+
bool quiet; // suppress all progress output to terminal
4646
size_t read_step; // only process reads that are multiple of read_step
4747
size_t threads; // number of threads to read multiple files in parallel
4848
std::string call; // the function call
@@ -53,6 +53,9 @@ struct FalcoConfig {
5353
static const std::string html_template; // the html for the template
5454
std::string tmpdir; // dir for temp files when generating report images
5555

56+
// Falco only
57+
bool progress; // report the progress bar
58+
5659
// config on how to handle reads
5760
bool do_duplication,
5861
do_kmer,

src/falco.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ read_stream_into_stats(T &in, FastqStats &stats, FalcoConfig &falco_config) {
6464
size_t tot_bytes_read = 0;
6565

6666
// Read record by record
67-
const bool quiet = falco_config.quiet;
67+
const bool report_progress = falco_config.progress;
6868
ProgressBar progress(file_size, "running falco");
69-
if (!quiet)
69+
if (report_progress)
7070
progress.report(std::cerr, 0);
7171
while (in.read_entry(stats, tot_bytes_read)) {
72-
if (!quiet && progress.time_to_report(tot_bytes_read))
72+
if (report_progress && progress.time_to_report(tot_bytes_read))
7373
progress.report(std::cerr, tot_bytes_read);
7474
}
7575

@@ -78,7 +78,7 @@ read_stream_into_stats(T &in, FastqStats &stats, FalcoConfig &falco_config) {
7878
if (in.tile_ignore)
7979
falco_config.do_tile = false;
8080

81-
if (!quiet && tot_bytes_read < file_size)
81+
if (report_progress && tot_bytes_read < file_size)
8282
progress.report(std::cerr, file_size);
8383
}
8484

@@ -538,6 +538,10 @@ main(int argc, char *argv[]) {
538538
"other parts of a workflow.",
539539
false, allow_empty_input);
540540

541+
opt_parse.add_opt("progress", '\0',
542+
"[Falco only] Report a progress bar while running.",
543+
false, falco_config.progress);
544+
541545
std::vector<std::string> leftover_args;
542546
opt_parse.parse(argc, argv, leftover_args);
543547
if (argc == 1 || opt_parse.help_requested()) {

0 commit comments

Comments
 (0)