Returns the command representing the trace up to this point. Args: include_separators: Whether or not to include separators in the command. Returns: A string representing a Fire CLI command that would produce this trace.
(self, include_separators=True)
| 164 | return shlex.quote(arg) |
| 165 | |
| 166 | def GetCommand(self, include_separators=True): |
| 167 | """Returns the command representing the trace up to this point. |
| 168 | |
| 169 | Args: |
| 170 | include_separators: Whether or not to include separators in the command. |
| 171 | |
| 172 | Returns: |
| 173 | A string representing a Fire CLI command that would produce this trace. |
| 174 | """ |
| 175 | args = [] |
| 176 | if self.name: |
| 177 | args.append(self.name) |
| 178 | |
| 179 | for element in self.elements: |
| 180 | if element.HasError(): |
| 181 | continue |
| 182 | if element.args: |
| 183 | args.extend(element.args) |
| 184 | if element.HasSeparator() and include_separators: |
| 185 | args.append(self.separator) |
| 186 | |
| 187 | if self.NeedsSeparator() and include_separators: |
| 188 | args.append(self.separator) |
| 189 | |
| 190 | return ' '.join(self._Quote(arg) for arg in args) |
| 191 | |
| 192 | def NeedsSeparator(self): |
| 193 | """Returns whether a separator should be added to the command. |