Hey, I’m Darren. I’m a software engineer from Scotland who enjoys working on open source projects. I specialise in Python and writing developer tools which run in the terminal. My most well known projects are Posting, a modern HTTP client which runs in the terminal, and Elia, a TUI for interacting with local and proprietary LLMs. This site is a collection of tips, tutorials, random thoughts, and anything else I feel like writing about!
Introducing Posting 2.0
Posting is a powerful HTTP client that runs entirely inside your terminal.
Version 2.0 has just arrived, bringing some powerful new features to Posting, including scripting, keymaps, and more!
Pre-request and post-response scripts
A common feature request has been around adding scripting capabilities to Posting. With 2.0, you can now attach Python functions to requests, and have them run before or after the request is sent. All output from these scripts is captured and displayed in the new “Scripts” tab. This makes it easy to see the results of your script executions and troubleshoot any issues.
…Custom keymaps in Textual
Textual 0.82.0 adds support for keymaps, which make it easy to customise keybindings based on config or user preferences.
Keymaps allow you to swap the keys associated with a Binding
at runtime with a single method call.
- You could switch to a Vim keymap if a user of your app enables “Vim mode”.
- You could read a keymap from a file on the users drive and swap it in on app startup.
- You could swap the increment and decrement keys on April 1st!
The possibilities are endless!
…Copying and pasting in Textual
Terminal emulators are in general quite limited when it comes to copying and pasting. Fortunately, we have a few options when writing Textual apps which allow us to add support for copy and paste. Each has its own trade-offs. Let’s explore these options and look at how we can integrate them into our apps.
App.copy_to_clipboard
Textual’s App
class has a method called copy_to_clipboard
.
Pass a string into it, and it gets copied to the clipboard on the machine the emulator is running on.
There is a caveat here: If the terminal doesn’t support the required protocol then nothing will happen!