-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: change git class to namespace (#728)
- Loading branch information
1 parent
da55f85
commit a941440
Showing
3 changed files
with
87 additions
and
89 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 |
---|---|---|
|
@@ -5,84 +5,79 @@ | |
|
||
#include "faker-cxx/types/Country.h" | ||
|
||
namespace faker | ||
namespace faker::git | ||
{ | ||
class Git | ||
struct Author | ||
{ | ||
public: | ||
struct Author | ||
{ | ||
std::string name; | ||
std::string email; | ||
}; | ||
std::string name; | ||
std::string email; | ||
}; | ||
|
||
/** | ||
* @brief Returns a random branch name. | ||
* | ||
* @param maxIssueNum The maximum issue number in branch name. Defaults to `100`. | ||
* @returns Branch name. | ||
* | ||
* @code | ||
* Git::branch() // "capitalize-bus" | ||
* @endcode | ||
*/ | ||
static std::string branch(unsigned maxIssueNum = 100); | ||
/** | ||
* @brief Returns a random branch name. | ||
* | ||
* @param maxIssueNum The maximum issue number in branch name. Defaults to `100`. | ||
* @returns Branch name. | ||
* | ||
* @code | ||
* git::branch() // "capitalize-bus" | ||
* @endcode | ||
*/ | ||
std::string branch(unsigned maxIssueNum = 100); | ||
|
||
/** | ||
* @brief Generates a random date in form of string. | ||
* | ||
* @param years The range of years the date may be in the past. Defaults to `15`. | ||
* @returns Commit date. | ||
* | ||
* @code | ||
* Git::commitDate() // "Mon Jan 17 15:05:53 2022 +1100" | ||
* @endcode | ||
*/ | ||
static std::string commitDate(unsigned years = 15); | ||
/** | ||
* @brief Generates a random date in form of string. | ||
* | ||
* @param years The range of years the date may be in the past. Defaults to `15`. | ||
* @returns Commit date. | ||
* | ||
* @code | ||
* git::commitDate() // "Mon Jan 17 15:05:53 2022 +1100" | ||
* @endcode | ||
*/ | ||
std::string commitDate(unsigned years = 15); | ||
|
||
/** | ||
* @brief Generates a random commit entry in form of string. | ||
* | ||
* @param dateYears The range of years the date may be in the past. Defaults to `15`. | ||
* @param shaLength The length of output SHA hash. Defaults to `40`. | ||
* @param country The country set for name generating. Defaults to `England` (could be random, if there was a | ||
random language generator). | ||
* @returns Commit entry. | ||
* | ||
* @code | ||
* Git::commitEntry() // "commit 9cbc41bb8ce0438c8de9cb25a1c6ad33441d8aca | ||
Author: Rachel McLaughlin [email protected] | ||
Date: Mon Jan 17 15:05:53 2022 +1100 | ||
/** | ||
* @brief Generates a random commit entry in form of string. | ||
* | ||
* @param dateYears The range of years the date may be in the past. Defaults to `15`. | ||
* @param shaLength The length of output SHA hash. Defaults to `40`. | ||
* @param country The country set for name generating. Defaults to `England` (could be random, if there was a | ||
random language generator). | ||
* @returns Commit entry. | ||
* | ||
* @code | ||
* git::commitEntry() // "commit 9cbc41bb8ce0438c8de9cb25a1c6ad33441d8aca | ||
Author: Rachel McLaughlin [email protected] | ||
Date: Mon Jan 17 15:05:53 2022 +1100 | ||
spawn polyp" | ||
* @endcode | ||
*/ | ||
static std::string commitEntry(std::optional<unsigned> dateYears = std::nullopt, | ||
std::optional<unsigned> shaLength = std::nullopt, | ||
Country country = Country::England); | ||
spawn polyp" | ||
* @endcode | ||
*/ | ||
std::string commitEntry(std::optional<unsigned> dateYears = std::nullopt, | ||
std::optional<unsigned> shaLength = std::nullopt, Country country = Country::England); | ||
|
||
/** | ||
* @brief Generates a random commit message. | ||
* | ||
* @returns Commit message. | ||
* | ||
* @code | ||
* Git::commitMessage() // "spawn polyp" | ||
* @endcode | ||
*/ | ||
static std::string commitMessage(); | ||
/** | ||
* @brief Generates a random commit message. | ||
* | ||
* @returns Commit message. | ||
* | ||
* @code | ||
* git::commitMessage() // "spawn polyp" | ||
* @endcode | ||
*/ | ||
std::string commitMessage(); | ||
|
||
/** | ||
* @brief Returns a random SHA hash. | ||
* | ||
* @param length The length of output SHA hash. Defaults to `40`. | ||
* | ||
* @returns SHA hash. | ||
* | ||
* @code | ||
* Git::commitSha() // "9cbc41bb8ce0438c8de9cb25a1c6ad33441d8aca" | ||
* @endcode | ||
*/ | ||
static std::string commitSha(unsigned length = 40); | ||
}; | ||
/** | ||
* @brief Returns a random SHA hash. | ||
* | ||
* @param length The length of output SHA hash. Defaults to `40`. | ||
* | ||
* @returns SHA hash. | ||
* | ||
* @code | ||
* git::commitSha() // "9cbc41bb8ce0438c8de9cb25a1c6ad33441d8aca" | ||
* @endcode | ||
*/ | ||
std::string commitSha(unsigned length = 40); | ||
} |
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