Skip to content

Commit

Permalink
More docs
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Oct 12, 2024
1 parent ce7c02b commit 8b4f84b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
12 changes: 11 additions & 1 deletion docs/guide/requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ By default, this name is used to generate the filename, but you can also choose
Within the "Directory" field of this dialog, it's important to note that `.` refers to the currently loaded *collection* directory (that is, the directory that was loaded using the `--collection` option), and *not* necessarily the current working directory.

### Duplicating a request

With a the cursor over a request in the collection tree, press ++d++ to create a duplicate of that request. This will bring up a dialog allowing you to change the name and description of the request, or move it to another location.

To skip the dialog and quickly duplicate the request, press ++shift+d++, creating it as a sibling of the original request. The file name of the new request will be generated automatically. You can always modify the name and description after it's created in the `Info` tab.

## Saving a request

Press ++ctrl+s++ to save the currently open request.
Expand All @@ -49,4 +55,8 @@ If the request is already saved on disk, ++ctrl+s++ will overwrite the previous

Requests are stored on your file system as simple YAML files, suffixed with `.posting.yaml`.

A directory can be loaded into Posting using the `--collection` option, and all `.posting.yaml` files in that directory will be displayed in the sidebar.
A directory can be loaded into Posting using the `--collection` option, and all `.posting.yaml` files in that directory will be displayed in the sidebar.

## Deleting a request

You can delete a request by moving the cursor over it in the tree, and pressing ++backspace++.
4 changes: 4 additions & 0 deletions docs/guide/scripting.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ Press ++ctrl+e++ while a script input field inside the `Scripts` tab is focused
!!! warning
As of version 2.0.0, the script file must exist *before* pressing ++ctrl+e++. Posting will not create the file for you.

## Script logs

If your script writes to `stdout` or `stderr`, you'll see the output in the `Scripts` tab in the Response section.

### Example: Setup script

The **setup script** is run before the request is built.
Expand Down
2 changes: 0 additions & 2 deletions src/posting/widgets/variable_autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,8 @@ def _search_string(self, target_state: TargetState) -> str:
text = target_state.text
if is_cursor_within_variable(cursor, text):
variable_at_cursor = get_variable_at_cursor(cursor, text)
print(f"search string = {variable_at_cursor}")
return variable_at_cursor or ""
else:
print(f"search string = {target_state.text}")
return target_state.text

def get_variable_candidates(self, target_state: TargetState) -> list[DropdownItem]:
Expand Down

0 comments on commit 8b4f84b

Please sign in to comment.