MCPcopy Index your code
hub / github.com/idank/explainshell / Option

Class Option

explainshell/models.py:47–76  ·  view source on GitHub ↗

An extracted command-line option from a man page. short - a list of short options (-a, -b, ..) long - a list of long options (--a, --b) has_argument - specifies if one of the short/long options expects an additional argument positional - specifies if to consider this as positional a

Source from the content-addressed store, hash-verified

45
46
47class Option(BaseModel):
48 """An extracted command-line option from a man page.
49
50 short - a list of short options (-a, -b, ..)
51 long - a list of long options (--a, --b)
52 has_argument - specifies if one of the short/long options expects an additional argument
53 positional - specifies if to consider this as positional arguments
54 prefix - literal sigil a token must start with for this positional to claim
55 it (e.g. '@' in dig's '[@server]'); only meaningful when positional is set
56 nested_cmd - specifies if the arguments to this option can start a nested command
57 """
58
59 text: str
60 short: list[str] = []
61 long: list[str] = []
62 has_argument: bool | list[str] = False
63 positional: str | bool | None = None
64 prefix: str | None = None
65 nested_cmd: bool | list[str] = False
66 meta: dict | None = None
67
68 @property
69 def opts(self) -> list[str]:
70 return self.short + self.long
71
72 def __str__(self):
73 return "(" + ", ".join([str(x) for x in self.opts]) + ")"
74
75 def __repr__(self):
76 return f"<option {self}>"
77
78
79class ParsedManpage(BaseModel):

Callers 15

create_test_storeFunction · 0.90
setUpMethod · 0.90
_fake_runMethod · 0.90
_make_mpMethod · 0.90
_optFunction · 0.90

Calls

no outgoing calls