Hacker News new | ask | show | jobs
by stack_framer 12 days ago
I'm not too familiar with Espanso, but Textile is not a text expander. Textile allows you to pre-define a sequence of steps that dynamically generate the text you want, by running commands on your computer, reading your clipboard, or using hard-coded text you provide.

Here's a quick example, and one that I often use with Textile to generate a preview URL based on my current branch:

(1) Start with the output of the command `git branch --show-current` in the `~/code` directory (yielding text like `JIRA-1234/some-feature`).

(2) Replace all `/` characters with `-` (now the text is `JIRA-1234-some-feature`).

(3) Prepend `[preview](https://staging-`, which is the start of a markdown link (now the text is `[preview](https://staging-JIRA-1234-some-feature`).

(4) Append `.example.com)`, which is the end of the markdown link (now the text is `[preview](https://staging-JIRA-1234-some-feature.example.com)`).

(5) Copy the result to my clipboard.

With those steps saved in Textile, I can now click a button to run them over and over again (or use a keyboard shortcut if I assigned one). So no matter which branch I'm on, I'll always get a proper preview link without having to construct it manually myself.

1 comments

Can't this be done with a bash script? Or is this supposed to be a more convenient, ergonomic and declarative way to do it?
I'm certain everything Textile does could be handled by bash scripts, or any other script flavors / languages / tools. So, yes, Textile is supposed to be a more convenient way to do it.