From 4039ea46eea9efdfaf387d16ab094b7132fcd35a Mon Sep 17 00:00:00 2001 From: thetek Date: Sat, 24 Jun 2023 10:37:32 +0200 Subject: [PATCH] feat: help message --- build/build.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/build/build.py b/build/build.py index ff17f0e..d4a133c 100755 --- a/build/build.py +++ b/build/build.py @@ -283,6 +283,22 @@ def format_files(): subprocess.call(['clang-format', '-i', file]) +def show_help(): + ''' + show the help message. + ''' + print('usage: `build/build.py [subcommand]`.') + print() + print('valid subcommands:') + print(' debug compile a debug build') + print(' release compile a release build') + print(' test run tests') + print(' fmt format source files') + print(' clean clean build files') + print() + print('if no subcommand is provided, a debug build will be compiled.') + + def main(): # parse command line arguments if len(sys.argv) == 1: @@ -297,6 +313,8 @@ def main(): run_tests() elif sys.argv[1] == 'fmt': format_files() + elif sys.argv[1] in ('help', '-h', '--help'): + show_help() else: log_message(Color.Red, 'err', f'unknown subcommand `{sys.argv[1]}`') exit(1)