MCPcopy
hub / github.com/ranger/ranger / parse_setting_line

Method parse_setting_line

ranger/api/commands.py:171–202  ·  view source on GitHub ↗

Parses the command line argument that is passed to the `:set` command. Returns [option, value, name_complete]. Can parse incomplete lines too, and `name_complete` is a boolean indicating whether the option name looks like it's completed or unfinished. This

(self)

Source from the content-addressed store, hash-verified

169 self._shifted += 1
170
171 def parse_setting_line(self):
172 """
173 Parses the command line argument that is passed to the `:set` command.
174 Returns [option, value, name_complete].
175
176 Can parse incomplete lines too, and `name_complete` is a boolean
177 indicating whether the option name looks like it's completed or
178 unfinished. This is useful for generating tab completions.
179
180 >>> Command("set foo=bar").parse_setting_line()
181 ['foo', 'bar', True]
182 >>> Command("set foo").parse_setting_line()
183 ['foo', '', False]
184 >>> Command("set foo=").parse_setting_line()
185 ['foo', '', True]
186 >>> Command("set foo ").parse_setting_line()
187 ['foo', '', True]
188 >>> Command("set myoption myvalue").parse_setting_line()
189 ['myoption', 'myvalue', True]
190 >>> Command("set").parse_setting_line()
191 ['', '', False]
192 """
193 if self._setting_line is not None:
194 return self._setting_line
195 match = _SETTINGS_RE.match(self.rest(1))
196 if match:
197 self.firstpart += match.group(1) + '='
198 result = [match.group(1), match.group(2), True]
199 else:
200 result = [self.arg(1), self.rest(2), ' ' in self.rest(1)]
201 self._setting_line = result
202 return result
203
204 def parse_setting_line_v2(self):
205 """

Callers 7

parse_setting_line_v2Method · 0.95
tabMethod · 0.80
executeMethod · 0.80
executeMethod · 0.80
tabMethod · 0.80
executeMethod · 0.80
executeMethod · 0.80

Calls 3

restMethod · 0.95
argMethod · 0.95
groupMethod · 0.80

Tested by

no test coverage detected