コード例 #1
0
ファイル: shell.py プロジェクト: imlzg/lightbus
 def setup(self, parser, subparsers):
     parser_shell = subparsers.add_parser(
         "shell",
         help="Provide an interactive Lightbus shell",
         formatter_class=argparse.ArgumentDefaultsHelpFormatter,
     )
     command_utilities.setup_common_arguments(parser_shell)
     parser_shell.set_defaults(func=self.handle)
コード例 #2
0
ファイル: dump_schema.py プロジェクト: imlzg/lightbus
 def setup(self, parser, subparsers):
     parser_dumpschema = subparsers.add_parser(
         "dumpschema",
         help=
         "Dumps all currently present bus schemas to a file or directory",
         formatter_class=argparse.ArgumentDefaultsHelpFormatter,
     )
     group = parser_dumpschema.add_argument_group(
         title="Dump config schema command arguments")
     group.add_argument(
         "--out",
         "-o",
         help=("File or directory to write schema to. If a directory is "
               "specified one schema file will be created for each API. "
               "If omitted the schema will be written to standard out."),
         metavar="FILE_OR_DIRECTORY",
     )
     command_utilities.setup_common_arguments(parser_dumpschema)
     parser_dumpschema.set_defaults(func=self.handle)
コード例 #3
0
ファイル: run.py プロジェクト: gcollard/lightbus
    def setup(self, parser, subparsers):
        # pylint: disable=attribute-defined-outside-init
        self.all_features = [f.value for f in Feature]
        self.features_str = ", ".join(self.all_features)

        parser_run = subparsers.add_parser(
            "run",
            help="Run Lightbus",
            formatter_class=argparse.ArgumentDefaultsHelpFormatter)

        group = parser_run.add_argument_group(title="Run command arguments")
        group.add_argument(
            "--only",
            "-o",
            help=
            ("Only provide the specified features. Comma separated list. Possible values:"
             f" {self.features_str}"),
            type=csv_type,
        )
        group.add_argument(
            "--skip",
            "-k",
            help=
            ("Provide all except the specified features. Comma separated list. "
             f"Possible values: {self.features_str}"),
            type=csv_type,
        )
        group.add_argument(
            "--schema",
            "-m",
            help=
            ("Manually load the schema from the given file or directory. "
             "This will normally be provided by the schema transport, "
             "but manual loading may be useful during development or testing."
             ),
            metavar="FILE_OR_DIRECTORY",
        )
        parser_run.set_defaults(func=self.handle)

        command_utilities.setup_common_arguments(parser_run)
コード例 #4
0
ファイル: inspect.py プロジェクト: crazyguitar/lightbus
    def setup(self, parser, subparsers):
        parser_inspect = subparsers.add_parser(
            "inspect",
            help="Inspect events on the bus",
            formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        )
        group = parser_inspect.add_argument_group(title="Inspect command arguments")
        group.add_argument(
            "--json-path",
            "-j",
            help=("Search event body json for the givn value. Eg. address.city=London"),
            metavar="JSON_SEARCH",
        )
        group.add_argument(
            "--id",
            "-i",
            help=("Find a single event with this Lightbus event ID"),
            metavar="LIGHTBUS_EVENT_ID",
        )
        group.add_argument(
            "--native-id",
            "-n",
            help=("Find a single event with this broker-native ID"),
            metavar="NATIVE_EVENT_ID",
        )
        group.add_argument(
            "--api",
            "-a",
            help=("Find events for this API name. Supports the '*' wildcard."),
            metavar="API_NAME",
        )
        group.add_argument(
            "--event",
            "-e",
            help=("Find events for this event name. Supports the '*' wildcard."),
            metavar="EVENT_NAME",
        )
        group.add_argument(
            "--version",
            "-v",
            help=("Find events with the specified version number. Can be prefixed by <, >, <=, >="),
            metavar="VERSION_NUMBER",
            type=int,
        )
        group.add_argument(
            "--format",
            "-F",
            help="Formatting style. One of json, pretty, or human.",
            metavar="FORMAT",
            default="json",
            choices=("json", "pretty", "human"),
        )
        group.add_argument(
            "--cache-only", "-c", help=("Search the local cache only"), action="store_true"
        )
        group.add_argument(
            "--follow",
            "-f",
            help=(
                "Continually listen for new events matching the search criteria. "
                "May only be used on a single API"
            ),
            action="store_true",
        )
        group.add_argument("--internal", "-I", help="Include internal APIs", action="store_true")

        command_utilities.setup_common_arguments(parser_inspect)
        parser_inspect.set_defaults(func=self.handle)