This repository provides a collection of tools to manage the writing repository described in An Overpowered Writing System (TODO LINK).
It expects a writing repo in the Overpowered Writing System format:
TEMPLATE/
post.md
images/
some-post/
post.md
images/
image.png
some-other-post/
post.md
images/
image.png
- Install
gitand the Github CLIghif you haven't already - Download the appropriate
opwritingbinary for your OS/arch from the releases page - Rename the binary to
opwriting(remove the OS/arch information) and store it somewhere on your machine - Add the following to your
.bashrc/.zshrc, replacing theTODOs with the appropriate values:export PATH=/where/your/opwriting/binary/lives # Directory containing the 'opwriting' binary export WRITING_REPO_DIRPATH=/your/writing/repo # Your writing repo eval "$(opwriting shell)" # Adds functions to manage the repo (see below)
The eval "$(opwriting shell)" makes the following functions available. You might consider aliasing them (e.g. I use alias pj="jump_post", alias pn="new_post", etc.).
jump_post [search_term] [search_term2].. will:
- Collect all post directories across all branches in
$WRITING_REPO_DIRPATH - Present the user with a list, which is interactively filterable using
fzf - Upon selection, switch to the post's branch and cd to the post's directory
edit_post [search_term] [search_term2].. will do everything that jump_post does, plus open the post.md in the user's $EDITOR.
new_post post_word1 [post_word2]... will:
- Create a new branch on
$WRITING_REPO_DIRPATHby joining the post word args with-(e.g.new_post my new postcreatesmy-new-post) - Clone the
TEMPLATEdirectory to create a new directory with the same name as the branch - Open
post.mdin the user's$EDITOR
publish_post will:
- Create a pull request for the current branch, if it doesn't already exist
- Wait until the status checks pass
- Render the post in Chrome (assumes that you have a Markdown renderer like this one installed)
- Show instructions for creating a new link on Substack
💡 If you provide a
SUBSTACK_URLvalue in.overpowered-writing.envin the root of your repository, then that value will get used to display the link and the link will be clickable.