Skip to content

Commit

Permalink
sort the output of command listBinds
Browse files Browse the repository at this point in the history
  • Loading branch information
Sweet authored and Sweet committed Nov 1, 2024
1 parent f989ce9 commit 6ddfcf6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/engine/client/key_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ class ListBindsCmd: public Cmd::StaticCmd

void Run(const Cmd::Args&) const override
{
std::vector<std::string> lines;
for (auto& kv: keys)
{
bool teamSpecific = false;
Expand All @@ -482,7 +483,8 @@ class ListBindsCmd: public Cmd::StaticCmd
{
if ( kv.second.binding[ 0 ] )
{
Print( "%s → %s", ExtraInfoKeyString( kv.first ), kv.second.binding[ 0 ].value() );
std::string line = ExtraInfoKeyString( kv.first ) + "" + kv.second.binding[ 0 ].value();
lines.push_back( line );
}
}
else
Expand All @@ -491,11 +493,18 @@ class ListBindsCmd: public Cmd::StaticCmd
{
if ( kv.second.binding[ team ] )
{
Print( "%s [%s] → %s", ExtraInfoKeyString( kv.first ), teamName[ team ], kv.second.binding[ team ].value() );
std::string line = ExtraInfoKeyString( kv.first ) + " [" + teamName[ team ] + "] → " + kv.second.binding[ team ].value();
lines.push_back( line );
}
}
}
}

std::sort( lines.begin(), lines.end() );
for ( std::string line : lines )
{
Print( line );
}
}
};

Expand Down

0 comments on commit 6ddfcf6

Please sign in to comment.