Skip to content

Commit

Permalink
consolidate version_information
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavidsaver committed Jul 25, 2023
1 parent f5657e5 commit a2edecd
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 24 deletions.
8 changes: 8 additions & 0 deletions src/describe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,12 @@ std::ostream& target_information(std::ostream& strm)
return strm;
}

std::ostream& version_information(std::ostream& strm)
{
strm<<version_str()<<"\n";
strm<<EPICS_VERSION_STRING<<"\n";
strm<<"libevent "<<event_get_version()<<"\n";
return strm;
}

} // namespace pvxs
11 changes: 11 additions & 0 deletions src/pvxs/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ struct PVXS_API Detailed {
PVXS_API
std::ostream& target_information(std::ostream&);

/** Print version information for PVXS library and dependencies
*
* As shown by eg. ``pvxget -V``
*
* @returns The same ostream passed as argument.
*
* @since UNRELEASED
*/
PVXS_API
std::ostream& version_information(std::ostream&);

/** Thread-safe, bounded, multi-producer, multi-consumer FIFO queue.
*
* Queue value_type must be movable. If T is also copy constructable,
Expand Down
4 changes: 1 addition & 3 deletions tools/call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ int main(int argc, char *argv[])
usage(argv[0]);
return 0;
case 'V':
std::cout<<version_str()<<"\n";
std::cout<<EPICS_VERSION_STRING<<"\n";
std::cout<<"libevent "<<event_get_version()<<"\n";
std::cout<<pvxs::version_information;
return 0;
case 'v':
verbose = true;
Expand Down
4 changes: 1 addition & 3 deletions tools/get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ int main(int argc, char *argv[])
usage(argv[0]);
return 0;
case 'V':
std::cout<<version_str()<<"\n";
std::cout<<EPICS_VERSION_STRING<<"\n";
std::cout<<"libevent "<<event_get_version()<<"\n";
std::cout<<pvxs::version_information;
return 0;
case 'v':
verbose = true;
Expand Down
4 changes: 1 addition & 3 deletions tools/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ int main(int argc, char *argv[])
usage(argv[0]);
return 0;
case 'V':
std::cout<<version_str()<<"\n";
std::cout<<EPICS_VERSION_STRING<<"\n";
std::cout<<"libevent "<<event_get_version()<<"\n";
std::cout<<pvxs::version_information;
return 0;
case 'v':
verbose = true;
Expand Down
4 changes: 1 addition & 3 deletions tools/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ int main(int argc, char *argv[])
usage(argv[0]);
return 0;
case 'V':
std::cout<<version_str()<<"\n";
std::cout<<EPICS_VERSION_STRING<<"\n";
std::cout<<"libevent "<<event_get_version()<<"\n";
std::cout<<pvxs::version_information;
return 0;
case 'A':
active = true;
Expand Down
4 changes: 1 addition & 3 deletions tools/monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ int main(int argc, char *argv[])
usage(argv[0]);
return 0;
case 'V':
std::cout<<version_str()<<"\n";
std::cout<<EPICS_VERSION_STRING<<"\n";
std::cout<<"libevent "<<event_get_version()<<"\n";
std::cout<<pvxs::version_information;
return 0;
case 'v':
verbose = true;
Expand Down
4 changes: 1 addition & 3 deletions tools/mshim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,7 @@ int main(int argc, char *argv[])
usage(argv[0]);
return 0;
case 'V':
std::cout<<version_str()<<"\n";
std::cout<<EPICS_VERSION_STRING<<"\n";
std::cout<<"libevent "<<event_get_version()<<std::endl;
std::cout<<pvxs::version_information;
return 0;
default:
usage(argv[0]);
Expand Down
4 changes: 1 addition & 3 deletions tools/put.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ int main(int argc, char *argv[])
usage(argv[0]);
return 0;
case 'V':
std::cout<<version_str()<<"\n";
std::cout<<EPICS_VERSION_STRING<<"\n";
std::cout<<"libevent "<<event_get_version()<<"\n";
std::cout<<pvxs::version_information;
return 0;
case 'v':
verbose = true;
Expand Down
5 changes: 2 additions & 3 deletions tools/pvxvct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <osiSock.h>

#include <pvxs/log.h>
#include <pvxs/util.h>

#include <udp_collector.h>
#include <utilpvt.h>
Expand Down Expand Up @@ -133,9 +134,7 @@ int main(int argc, char *argv[])
usage(argv[0]);
return 0;
case 'V':
std::cout<<pva::version_str()<<"\n";
std::cout<<EPICS_VERSION_STRING<<"\n";
std::cout<<"libevent "<<event_get_version()<<"\n";
std::cout<<pvxs::version_information;
return 0;
default:
usage(argv[0]);
Expand Down

0 comments on commit a2edecd

Please sign in to comment.