Skip to content

Commit 88d12ce

Browse files
committed
Update "sp info" to tell whether or not it's a dedicated server + f-strings
1 parent b8a913e commit 88d12ce

File tree

1 file changed

+11
-9
lines changed
  • addons/source-python/packages/source-python/core/command

1 file changed

+11
-9
lines changed

addons/source-python/packages/source-python/core/command/__init__.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
# Engines
3131
from engines.server import execute_server_command
3232
from engines.server import queue_command_string
33+
from engines.server import engine_server
3334
# Paths
3435
from paths import SP_DATA_PATH
3536
# Plugins
@@ -133,24 +134,25 @@ def _sp_help(command_info, command=None, *server_sub_commands):
133134
@core_command.server_sub_command(['info'])
134135
def print_info(info):
135136
"""Print information about OS, SP and installed plugins."""
136-
result = '\nDate : {}'.format(datetime.now(UTC))
137-
result += '\nOS : {}'.format(platform.platform())
138-
result += '\nGame : {}'.format(SOURCE_ENGINE_BRANCH)
139-
result += '\nSP version : {}'.format(VERSION)
140-
result += '\nGithub commit : {}'.format(GIT_COMMIT)
137+
result = f'\nDate : {datetime.now(UTC)}'
138+
result += f'\nOS : {platform.platform()}'
139+
result += f'\nGame : {SOURCE_ENGINE_BRANCH}'
140+
result += f'\nDedicated : {engine_server.is_dedicated_server()}'
141+
result += f'\nSP version : {VERSION}'
142+
result += f'\nGithub commit : {GIT_COMMIT}'
141143
result += '\nServer plugins:'
142144
for index, plugin in enumerate(server_plugin_manager.loaded_plugins):
143-
result += '\n {:02d}: {}'.format(index, plugin.name)
145+
result += f'\n {index:02d}: {plugin.name}'
144146

145147
result += '\nSP plugins:'
146148
for index, plugin in enumerate(plugin_manager.loaded_plugins):
147-
result += '\n {:02d}: {}'.format(index, plugin.name)
149+
result += f'\n {index:02d}: {plugin.name}'
148150
info = plugin.info
149151
if info.version != 'unversioned':
150-
result += ', {}'.format(info.version)
152+
result += f', {info.version}'
151153

152154
if info.url is not None:
153-
result += ', {}'.format(info.url)
155+
result += f', {info.url}'
154156

155157
# Create a checksum for all the the essential information (from 'Date' to
156158
# the last SP plugin)

0 commit comments

Comments
 (0)