MCPcopy Index your code
hub / github.com/treeverse/dvc / DvcParser

Class DvcParser

dvc/cli/parser.py:121–136  ·  view source on GitHub ↗

Custom parser class for dvc CLI.

Source from the content-addressed store, hash-verified

119
120
121class DvcParser(argparse.ArgumentParser):
122 """Custom parser class for dvc CLI."""
123
124 def error(self, message, cmd_cls=None):
125 logger.error(message)
126 _find_parser(self, cmd_cls)
127
128 def parse_args(self, args=None, namespace=None):
129 # NOTE: overriding to provide a more granular help message.
130 # E.g. `dvc plots diff --bad-flag` would result in a `dvc plots diff`
131 # help message instead of generic `dvc` usage.
132 args, argv = self.parse_known_args(args, namespace)
133 if argv:
134 msg = "unrecognized arguments: %s"
135 self.error(msg % " ".join(argv), getattr(args, "func", None))
136 return args
137
138
139def get_parent_parser():

Callers 1

get_main_parserFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected