Skip to content

Commit

Permalink
allow working with clang-format v17 and v18, fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jakoch committed Jun 20, 2024
1 parent ccf0a75 commit 1f0529b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
13 changes: 8 additions & 5 deletions format.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/usr/bin/env bash

# allow ENV.CLANG_FORMAT to define the path to the binary or default to clang-format
# Allow ENV.CLANG_FORMAT to define the path to the binary or default to clang-format
CLANG_FORMAT=${CLANG_FORMAT:-clang-format}

# require clang-format 18 to have consistent formatting features
$CLANG_FORMAT --version
if [[ ! $($CLANG_FORMAT --version) =~ "version 18" ]]; then
echo "Error: clang-format version must be 18"
# Check clang-format version
VERSION=$("$CLANG_FORMAT" --version)

# Require clang-format 17 or 18 for consistent formatting features
if [[ ! $VERSION =~ "version 17" && ! $VERSION =~ "version 18" ]]; then
echo "Error: Unsupported clang-format version. Must be version 17 or 18."
echo "Found version: $VERSION"
exit 1
fi

Expand Down
6 changes: 3 additions & 3 deletions src/DateTimeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ std::string getDateTime(time_t const & time, char const * time_format)

std::string format_duration_get_minutes(int msecs)
{
using std::chrono::duration_cast;
using std::chrono::hours;
using std::chrono::milliseconds;
using std::chrono::seconds;
using std::chrono::minutes;
using std::chrono::hours;
using std::chrono::duration_cast;
using std::chrono::seconds;

auto ms = milliseconds(msecs);
auto secs = duration_cast<seconds>(ms);
Expand Down
5 changes: 4 additions & 1 deletion src/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ int main(int argc, char** argv)
printHelp();
return 0;
} else if (option == "-V" || option == "--V" || option == "-version") {
fmt::print("{} version {}\n", WinCliColors::formatLightGreen(CSGO_CLI_BINARYNAME), WinCliColors::formatYellow(CSGO_CLI_VERSION));
fmt::print(
"{} version {}\n",
WinCliColors::formatLightGreen(CSGO_CLI_BINARYNAME),
WinCliColors::formatYellow(CSGO_CLI_VERSION));
return 0;
} else if (option == "-v" || option == "--v" || option == "-verbose") {
paramVerbose = true;
Expand Down

0 comments on commit 1f0529b

Please sign in to comment.