mintro: enforced order for subcommands

pull/7314/head
TheQwertiest 4 years ago committed by Dylan Baker
parent 58c2aeb5e4
commit f1288ac7ec
  1. 26
      mesonbuild/mintro.py

@ -19,6 +19,7 @@ tests and so on. All output is in JSON for simple parsing.
Currently only works for the Ninja backend. Others use generated Currently only works for the Ninja backend. Others use generated
project files and don't need this info.""" project files and don't need this info."""
import collections
import json import json
from . import build, coredata as cdata from . import build, coredata as cdata
from . import mesonlib from . import mesonlib
@ -61,18 +62,19 @@ def get_meson_introspection_types(coredata: T.Optional[cdata.CoreData] = None,
else: else:
benchmarkdata = testdata = installdata = None benchmarkdata = testdata = installdata = None
return { # Enforce key order for argparse
'ast': IntroCommand('Dump the AST of the meson file', no_bd=dump_ast), return collections.OrderedDict([
'benchmarks': IntroCommand('List all benchmarks', func=lambda: list_benchmarks(benchmarkdata)), ('ast', IntroCommand('Dump the AST of the meson file', no_bd=dump_ast)),
'buildoptions': IntroCommand('List all build options', func=lambda: list_buildoptions(coredata), no_bd=list_buildoptions_from_source), ('benchmarks', IntroCommand('List all benchmarks', func=lambda: list_benchmarks(benchmarkdata))),
'buildsystem_files': IntroCommand('List files that make up the build system', func=lambda: list_buildsystem_files(builddata, interpreter)), ('buildoptions', IntroCommand('List all build options', func=lambda: list_buildoptions(coredata), no_bd=list_buildoptions_from_source)),
'dependencies': IntroCommand('List external dependencies', func=lambda: list_deps(coredata), no_bd=list_deps_from_source), ('buildsystem_files', IntroCommand('List files that make up the build system', func=lambda: list_buildsystem_files(builddata, interpreter))),
'scan_dependencies': IntroCommand('Scan for dependencies used in the meson.build file', no_bd=list_deps_from_source), ('dependencies', IntroCommand('List external dependencies', func=lambda: list_deps(coredata), no_bd=list_deps_from_source)),
'installed': IntroCommand('List all installed files and directories', func=lambda: list_installed(installdata)), ('scan_dependencies', IntroCommand('Scan for dependencies used in the meson.build file', no_bd=list_deps_from_source)),
'projectinfo': IntroCommand('Information about projects', func=lambda: list_projinfo(builddata), no_bd=list_projinfo_from_source), ('installed', IntroCommand('List all installed files and directories', func=lambda: list_installed(installdata))),
'targets': IntroCommand('List top level targets', func=lambda: list_targets(builddata, installdata, backend), no_bd=list_targets_from_source), ('projectinfo', IntroCommand('Information about projects', func=lambda: list_projinfo(builddata), no_bd=list_projinfo_from_source)),
'tests': IntroCommand('List all unit tests', func=lambda: list_tests(testdata)), ('targets', IntroCommand('List top level targets', func=lambda: list_targets(builddata, installdata, backend), no_bd=list_targets_from_source)),
} ('tests', IntroCommand('List all unit tests', func=lambda: list_tests(testdata))),
])
def add_arguments(parser): def add_arguments(parser):
intro_types = get_meson_introspection_types() intro_types = get_meson_introspection_types()

Loading…
Cancel
Save