47
47
#include " Bam2FastQ.h"
48
48
#include " PhoneHome.h"
49
49
50
- void Usage ( )
50
+ void WriteUsage (std::ostream& os )
51
51
{
52
52
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;
55
55
Convert::convertDescription ();
56
56
WriteRegion::writeRegionDescription ();
57
57
SplitChromosome::splitChromosomeDescription ();
58
58
SplitBam::splitBamDescription ();
59
59
FindCigars::findCigarsDescription ();
60
60
61
- std::cerr << " \n Tools to Modify & write SAM/BAM Files: " << std::endl;
61
+ os << " \n Tools to Modify & write SAM/BAM Files: " << std::endl;
62
62
ClipOverlap::clipOverlapDescription ();
63
63
Filter::filterDescription ();
64
64
Revert::revertDescription ();
@@ -70,33 +70,33 @@ void Usage()
70
70
Dedup_LowMem::dedup_LowMemDescription ();
71
71
Recab::recabDescription ();
72
72
73
- std::cerr << " \n Informational Tools\n " ;
73
+ os << " \n Informational Tools\n " ;
74
74
Validate::validateDescription ();
75
75
Diff::diffDescription ();
76
76
Stats::statsDescription ();
77
77
GapInfo::gapInfoDescription ();
78
78
79
- std::cerr << " \n Tools to Print Information In Readable Format\n " ;
79
+ os << " \n Tools to Print Information In Readable Format\n " ;
80
80
DumpHeader::dumpHeaderDescription ();
81
81
DumpRefInfo::dumpRefInfoDescription ();
82
82
DumpIndex::dumpIndexDescription ();
83
83
ReadReference::readReferenceDescription ();
84
84
ExplainFlags::explainFlagsDescription ();
85
85
86
- std::cerr << " \n Additional Tools\n " ;
86
+ os << " \n Additional Tools\n " ;
87
87
Bam2FastQ::bam2FastQDescription ();
88
88
89
- std::cerr << " \n Dummy/Example Tools\n " ;
89
+ os << " \n Dummy/Example Tools\n " ;
90
90
ReadIndexedBam::readIndexedBamDescription ();
91
91
92
92
93
- std::cerr << std::endl;
94
- std::cerr << " Usage: " << std::endl;
95
- std::cerr << " \t bam <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 << " \t bam (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 << " \t bam <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 << " \t bam (usage|help)" << std::endl;
99
+ os << " Will print this error message and exit." << std::endl;
100
100
}
101
101
102
102
@@ -108,15 +108,15 @@ int main(int argc, char ** argv)
108
108
if (argc < 2 )
109
109
{
110
110
// Not enough args...
111
- Usage ( );
111
+ WriteUsage (std::cerr );
112
112
exit (-1 );
113
113
}
114
114
115
115
String cmd = argv[1 ];
116
116
117
117
if (cmd.SlowCompare (" usage" ) == 0 || cmd.SlowCompare (" help" ) == 0 )
118
118
{
119
- Usage ( );
119
+ WriteUsage (std::cout );
120
120
exit (0 );
121
121
}
122
122
else if (cmd.SlowCompare (" readIndexedBam" ) == 0 )
@@ -234,7 +234,7 @@ int main(int argc, char ** argv)
234
234
{
235
235
if (strcmp (argv[3 ], " NOEOF" ) != 0 )
236
236
{
237
- Usage ( );
237
+ WriteUsage (std::cerr );
238
238
exit (-1 );
239
239
}
240
240
else
@@ -244,7 +244,7 @@ int main(int argc, char ** argv)
244
244
}
245
245
else
246
246
{
247
- Usage ( );
247
+ WriteUsage (std::cerr );
248
248
exit (-1 );
249
249
}
250
250
}
0 commit comments