mirror of
https://github.com/httpie/cli.git
synced 2025-05-31 23:09:49 +02:00
A few edits
This commit is contained in:
parent
980bd59e29
commit
eb4e32ca28
@ -782,10 +782,9 @@ $ http --offline --print=B pie.dev/post \
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Starting with 3.0, we have embedded a mini language inside HTTPie's own syntax to
|
Starting with 3.0, we have created a mini language in HTTPie's own syntax to
|
||||||
build complex JSON with ease. This syntax was inspired by the [JSON form](https://www.w3.org/TR/html-json-forms/)
|
build complex JSON objects with ease. This syntax was inspired by the [JSON form](https://www.w3.org/TR/html-json-forms/)
|
||||||
proposal for HTML, though we have changed a lot of parts to offer the best experience
|
proposal for HTML, though we have changed a lot of parts to offer the best experience.
|
||||||
and reduce the number of typing-caused failures.
|
|
||||||
|
|
||||||
#### Introduction
|
#### Introduction
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ class Path:
|
|||||||
def reconstruct(self) -> str:
|
def reconstruct(self) -> str:
|
||||||
if self.kind == 'key':
|
if self.kind == 'key':
|
||||||
if self.is_root:
|
if self.is_root:
|
||||||
return self.accessor
|
return str(self.accessor)
|
||||||
return '[' + self.accessor + ']'
|
return '[' + self.accessor + ']'
|
||||||
elif self.kind == 'index':
|
elif self.kind == 'index':
|
||||||
return '[' + str(self.accessor) + ']'
|
return '[' + str(self.accessor) + ']'
|
||||||
@ -186,10 +186,12 @@ def parse(source: str) -> Iterator[Path]:
|
|||||||
cursor += 1
|
cursor += 1
|
||||||
if token.kind in kinds:
|
if token.kind in kinds:
|
||||||
return token
|
return token
|
||||||
else:
|
elif tokens:
|
||||||
token = tokens[-1]._replace(
|
token = tokens[-1]._replace(
|
||||||
start=tokens[-1].end + 0, end=tokens[-1].end + 1
|
start=tokens[-1].end + 0, end=tokens[-1].end + 1
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
token = None
|
||||||
|
|
||||||
if len(kinds) == 1:
|
if len(kinds) == 1:
|
||||||
suffix = kinds[0].to_name()
|
suffix = kinds[0].to_name()
|
||||||
@ -272,7 +274,7 @@ def interpret(context: Any, key: str, value: Any) -> Any:
|
|||||||
key, pseudo_token, message, message_kind='Type'
|
key, pseudo_token, message, message_kind='Type'
|
||||||
)
|
)
|
||||||
|
|
||||||
def object_for(kind: str) -> str:
|
def object_for(kind: str) -> Any:
|
||||||
if kind == 'key':
|
if kind == 'key':
|
||||||
return {}
|
return {}
|
||||||
elif kind in {'index', 'append'}:
|
elif kind in {'index', 'append'}:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user