Skip to content

Commit 41a97bf

Browse files
committed
Change main usage output stream to stdout.
1 parent 661a3dc commit 41a97bf

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/Main.cpp

+19-19
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,18 @@
4747
#include "Bam2FastQ.h"
4848
#include "PhoneHome.h"
4949

50-
void Usage()
50+
void WriteUsage(std::ostream& os)
5151
{
5252
BamExecutable::bamExecutableDescription();
53-
std::cerr << std::endl;
54-
std::cerr << "Tools to Rewrite SAM/BAM Files: " << std::endl;
53+
os << std::endl;
54+
os << "Tools to Rewrite SAM/BAM Files: " << std::endl;
5555
Convert::convertDescription();
5656
WriteRegion::writeRegionDescription();
5757
SplitChromosome::splitChromosomeDescription();
5858
SplitBam::splitBamDescription();
5959
FindCigars::findCigarsDescription();
6060

61-
std::cerr << "\nTools to Modify & write SAM/BAM Files: " << std::endl;
61+
os << "\nTools to Modify & write SAM/BAM Files: " << std::endl;
6262
ClipOverlap::clipOverlapDescription();
6363
Filter::filterDescription();
6464
Revert::revertDescription();
@@ -70,33 +70,33 @@ void Usage()
7070
Dedup_LowMem::dedup_LowMemDescription();
7171
Recab::recabDescription();
7272

73-
std::cerr << "\nInformational Tools\n";
73+
os << "\nInformational Tools\n";
7474
Validate::validateDescription();
7575
Diff::diffDescription();
7676
Stats::statsDescription();
7777
GapInfo::gapInfoDescription();
7878

79-
std::cerr << "\nTools to Print Information In Readable Format\n";
79+
os << "\nTools to Print Information In Readable Format\n";
8080
DumpHeader::dumpHeaderDescription();
8181
DumpRefInfo::dumpRefInfoDescription();
8282
DumpIndex::dumpIndexDescription();
8383
ReadReference::readReferenceDescription();
8484
ExplainFlags::explainFlagsDescription();
8585

86-
std::cerr << "\nAdditional Tools\n";
86+
os << "\nAdditional Tools\n";
8787
Bam2FastQ::bam2FastQDescription();
8888

89-
std::cerr << "\nDummy/Example Tools\n";
89+
os << "\nDummy/Example Tools\n";
9090
ReadIndexedBam::readIndexedBamDescription();
9191

9292

93-
std::cerr << std::endl;
94-
std::cerr << "Usage: " << std::endl;
95-
std::cerr << "\tbam <tool> [<tool arguments>]" << std::endl;
96-
std::cerr << "The usage for each tool is described by specifying the tool with no arguments." << std::endl;
97-
std::cerr << std::endl;
98-
std::cerr << "\tbam (usage|help)" << std::endl;
99-
std::cerr << "Will print this error message and exit." << std::endl;
93+
os << std::endl;
94+
os << "Usage: " << std::endl;
95+
os << "\tbam <tool> [<tool arguments>]" << std::endl;
96+
os << "The usage for each tool is described by specifying the tool with no arguments." << std::endl;
97+
os << std::endl;
98+
os << "\tbam (usage|help)" << std::endl;
99+
os << "Will print this error message and exit." << std::endl;
100100
}
101101

102102

@@ -108,15 +108,15 @@ int main(int argc, char ** argv)
108108
if(argc < 2)
109109
{
110110
// Not enough args...
111-
Usage();
111+
WriteUsage(std::cerr);
112112
exit(-1);
113113
}
114114

115115
String cmd = argv[1];
116116

117117
if(cmd.SlowCompare("usage") == 0 || cmd.SlowCompare("help") == 0)
118118
{
119-
Usage();
119+
WriteUsage(std::cout);
120120
exit(0);
121121
}
122122
else if(cmd.SlowCompare("readIndexedBam") == 0)
@@ -234,7 +234,7 @@ int main(int argc, char ** argv)
234234
{
235235
if(strcmp(argv[3], "NOEOF") != 0)
236236
{
237-
Usage();
237+
WriteUsage(std::cerr);
238238
exit(-1);
239239
}
240240
else
@@ -244,7 +244,7 @@ int main(int argc, char ** argv)
244244
}
245245
else
246246
{
247-
Usage();
247+
WriteUsage(std::cerr);
248248
exit(-1);
249249
}
250250
}

0 commit comments

Comments
 (0)