-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added utilities to standardize help across cli tools. #370
- Loading branch information
Jon McLean
committed
Jun 9, 2023
1 parent
0acff41
commit 84e6910
Showing
3 changed files
with
55 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
#ifndef DISKANN_PROGRAM_OPTIONS_UTILS_CPP | ||
#define DISKANN_PROGRAM_OPTIONS_UTILS_CPP | ||
|
||
#include <string.h> | ||
|
||
namespace program_options_utils | ||
{ | ||
/** | ||
* String appended to command-line tool help output to make the user aware that an argument is required | ||
*/ | ||
inline const char required[] = "*"; | ||
|
||
const std::string make_required_param(const char *input) | ||
{ | ||
return std::string(required).append(" ").append(input); | ||
} | ||
|
||
const std::string make_program_description(const char *executable_name, const char *description) | ||
{ | ||
return std::string("\n") | ||
.append(description) | ||
.append("\n\n") | ||
.append("Arguments with ") | ||
.append(required) | ||
.append(" are required") | ||
.append("\n\n") | ||
.append("Usage: ") | ||
.append(executable_name) | ||
.append(" [OPTIONS]"); | ||
} | ||
} // namespace program_options_utils | ||
|
||
#endif // DISKANN_PROGRAM_OPTIONS_UTILS_CPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters